70 STM32SPIDevice(SPI_HandleTypeDef *hspi, GPIO_TypeDef *csPort, uint16_t csPin, uint32_t timeoutMs = 100);
88 bool read(uint8_t *buffer,
size_t len, uint8_t sendValue = 0xFF);
109 bool write(
const uint8_t *buffer,
size_t len,
const uint8_t *prefixBuffer =
nullptr,
size_t prefixLen = 0);
138 bool writeThenRead(
const uint8_t *writeBuffer,
size_t writeLen, uint8_t *readBuffer,
size_t readLen, uint8_t sendValue = 0xFF);
157 void transfer(uint8_t *buffer,
size_t len);
169 static constexpr size_t kMaxCombinedBytes = 32;
171 SPI_HandleTypeDef *_hspi;
172 GPIO_TypeDef *_csPort;
bool write(const uint8_t *buffer, size_t len, const uint8_t *prefixBuffer=nullptr, size_t prefixLen=0)
Writes len bytes from buffer, optionally preceded by a separate prefix buffer (e.g....
bool read(uint8_t *buffer, size_t len, uint8_t sendValue=0xFF)
Reads len bytes into buffer, clocking out sendValue for each byte read. Brackets the transfer with ch...
bool writeThenRead(const uint8_t *writeBuffer, size_t writeLen, uint8_t *readBuffer, size_t readLen, uint8_t sendValue=0xFF)
Writes writeLen bytes, then reads readLen bytes, all within a single chip-select assert/deassert brac...
STM32SPIDevice(SPI_HandleTypeDef *hspi, GPIO_TypeDef *csPort, uint16_t csPin, uint32_t timeoutMs=100)
Constructs the device wrapper. Does not touch hardware – HAL_GPIO_Init()/HAL_SPI_Init() for the under...
: Header for main.c file. This file contains the common defines of the application.