7#ifdef HAL_SPI_MODULE_ENABLED
13#include "libxr_def.hpp"
14#include "libxr_rw.hpp"
47stm32_spi_id_t STM32_SPI_GetID(SPI_TypeDef *addr);
55 uint32_t dma_enable_min_size = 3);
72 SPI_HandleTypeDef *spi_handle_;
74 stm32_spi_id_t id_ = STM32_SPI_ID_ERROR;
76 uint32_t dma_enable_min_size_ = 3;
82 bool mem_read_ =
false;
84 static STM32SPI *map[STM32_SPI_NUMBER];
常量原始数据封装类。 A class for encapsulating constant raw data.
原始数据封装类。 A class for encapsulating raw data.
串行外设接口(SPI)抽象类。Abstract class for Serial Peripheral Interface (SPI).
ErrorCode ReadAndWrite(RawData read_data, ConstRawData write_data, OperationRW &op) override
进行 SPI 读写操作。Performs SPI read and write operations.
ErrorCode MemRead(uint16_t reg, RawData read_data, OperationRW &op) override
从 SPI 设备的寄存器读取数据。 Reads data from a specific register of the SPI device.
ErrorCode MemWrite(uint16_t reg, ConstRawData write_data, OperationRW &op) override
向 SPI 设备的寄存器写入数据。 Writes data to a specific register of the SPI device.
uint32_t GetMaxBusSpeed() const override
获取 SPI 设备的最大时钟速度。Gets the maximum clock speed of the SPI device.
ErrorCode Transfer(size_t size, OperationRW &op) override
进行一次SPI传输(使用当前缓冲区数据,零拷贝,支持双缓冲)。 Performs a SPI transfer (zero-copy, supports double buffering).
ErrorCode SetConfig(SPI::Configuration config) override
设置 SPI 配置参数。Sets SPI configuration parameters.
Prescaler GetMaxPrescaler() const override
获取 SPI 设备的最大分频系数。Gets the maximum prescaler of the SPI device.
存储 SPI 配置参数的结构体。Structure for storing SPI configuration parameters.