libxr 1.0
Want to be the best embedded framework
|
串行外设接口(SPI)抽象类。Abstract class for Serial Peripheral Interface (SPI). More...
#include <spi.hpp>
Data Structures | |
struct | Configuration |
存储 SPI 配置参数的结构体。Structure for storing SPI configuration parameters. More... | |
struct | ReadWriteInfo |
存储 SPI 读写操作信息的结构体。Structure for storing SPI read/write operation information. More... | |
Public Types | |
enum class | ClockPolarity : uint8_t { LOW = 0 , HIGH = 1 } |
定义 SPI 时钟极性。Defines the SPI clock polarity. More... | |
enum class | ClockPhase : uint8_t { EDGE_1 = 0 , EDGE_2 = 1 } |
定义 SPI 时钟相位。Defines the SPI clock phase. More... | |
using | OperationRW = WriteOperation |
定义读写操作类型的别名。Defines an alias for the read/write operation type. | |
Public Member Functions | |
SPI () | |
默认构造函数。Default constructor. | |
virtual ErrorCode | ReadAndWrite (RawData read_data, ConstRawData write_data, OperationRW &op)=0 |
进行 SPI 读写操作。Performs SPI read and write operations. | |
virtual ErrorCode | Read (RawData read_data, OperationRW &op) |
进行 SPI 读取操作。Performs SPI read operation. | |
virtual ErrorCode | Write (ConstRawData write_data, OperationRW &op) |
进行 SPI 写入操作。Performs SPI write operation. | |
virtual ErrorCode | SetConfig (Configuration config)=0 |
设置 SPI 配置参数。Sets SPI configuration parameters. | |
virtual ErrorCode | MemWrite (uint16_t reg, ConstRawData write_data, OperationRW &op)=0 |
向 SPI 设备的寄存器写入数据。 Writes data to a specific register of the SPI device. | |
virtual ErrorCode | MemRead (uint16_t reg, RawData read_data, OperationRW &op)=0 |
从 SPI 设备的寄存器读取数据。 Reads data from a specific register of the SPI device. | |
串行外设接口(SPI)抽象类。Abstract class for Serial Peripheral Interface (SPI).
|
strong |
|
strong |
|
pure virtual |
从 SPI 设备的寄存器读取数据。 Reads data from a specific register of the SPI device.
reg | 寄存器地址。Register address. |
read_data | 读取的数据缓冲区。Buffer to store read data. |
op | 操作类型(同步/异步)。Operation mode (sync/async). |
Implemented in LibXR::STM32SPI.
|
pure virtual |
向 SPI 设备的寄存器写入数据。 Writes data to a specific register of the SPI device.
reg | 寄存器地址。Register address. |
write_data | 写入的数据缓冲区。Buffer containing data to write. |
op | 操作类型(同步/异步)。Operation mode (sync/async). |
Implemented in LibXR::STM32SPI.
|
inlinevirtual |
进行 SPI 读取操作。Performs SPI read operation.
read_data | 存储读取数据的缓冲区。Buffer to store the read data. |
op | 读写操作类型。Type of read/write operation. |
Definition at line 84 of file spi.hpp.
|
pure virtual |
进行 SPI 读写操作。Performs SPI read and write operations.
read_data | 存储读取数据的缓冲区。Buffer to store the read data. |
write_data | 需要写入的数据缓冲区。Buffer containing the data to be written. |
op | 读写操作类型。Type of read/write operation. |
Implemented in LibXR::STM32SPI.
|
pure virtual |
设置 SPI 配置参数。Sets SPI configuration parameters.
Implemented in LibXR::STM32SPI.
|
inlinevirtual |