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);
61 uint32_t dma_enable_min_size = 3);
64 bool in_isr)
override;
69 bool in_isr)
override;
72 bool in_isr)
override;
80 SPI_HandleTypeDef* spi_handle_;
82 stm32_spi_id_t id_ = STM32_SPI_ID_ERROR;
84 uint32_t dma_enable_min_size_ = 3;
90 bool mem_read_ =
false;
92 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).
STM32 SPI 驱动实现 / STM32 SPI driver implementation.
ErrorCode MemWrite(uint16_t reg, ConstRawData write_data, OperationRW &op, bool in_isr) override
向 SPI 设备的寄存器写入数据。 Writes data to a specific register of the SPI device.
ErrorCode MemRead(uint16_t reg, RawData read_data, OperationRW &op, bool in_isr) override
从 SPI 设备的寄存器读取数据。 Reads data from a specific register of the SPI device.
STM32SPI(SPI_HandleTypeDef *spi_handle, RawData dma_buff_rx, RawData dma_buff_tx, uint32_t dma_enable_min_size=3)
构造 SPI 对象 / Construct SPI object
uint32_t GetMaxBusSpeed() const override
获取 SPI 设备的最大时钟速度。Gets the maximum clock speed of the SPI device.
ErrorCode Transfer(size_t size, OperationRW &op, bool in_isr) 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.
ErrorCode ReadAndWrite(RawData read_data, ConstRawData write_data, OperationRW &op, bool in_isr) override
进行 SPI 读写操作。Performs SPI read and write operations.
存储 SPI 配置参数的结构体。Structure for storing SPI configuration parameters.