Skyward boardcore
|
Driver for STM32 low level SPI peripheral. More...
#include <SPIBus.h>
Public Member Functions | |
SPIBus (SPIType *spi) | |
Delete copy/move contructors/operators. | |
SPIBus (const SPIBus &)=delete | |
SPIBus & | operator= (const SPIBus &)=delete |
SPIBus (SPIBus &&)=delete | |
SPIBus & | operator= (SPIBus &&)=delete |
SPIType * | getSpi () |
Retrieve the pointer to the peripheral currently used. | |
void | reset () |
Resets the peripheral configuration. | |
void | enable () |
Enables the peripheral. | |
void | disable () |
Disables the peripheral. | |
void | set8BitFrameFormat () |
void | enableSoftwareSlaveManagement () |
void | disableSoftwareSlaveManagement () |
void | enableInternalSlaveSelection () |
void | disableInternalSlaveSelection () |
void | setBitOrder (SPI::Order bitOrder) |
void | setClockDiver (SPI::ClockDivider divider) |
void | setSlaveConfiguration () |
void | setMasterConfiguration () |
void | setMode (SPI::Mode mode) |
void | enableTxDMARequest () |
void | disableTxDMARequest () |
void | enableRxDMARequest () |
void | disableRxDMARequest () |
void | waitPeripheral () |
void | flushRxBuffer () |
void | configure (SPIBusConfig newConfig) override |
Configures and enables the bus with the provided configuration. | |
void | select (GpioType cs) override |
See SPIBusInterface::select(). | |
void | deselect (GpioType cs) override |
See SPIBusInterface::deselect(). | |
uint8_t | read () override |
Reads 8 bits from the bus. | |
uint16_t | read16 () override |
Reads 16 bits from the bus. | |
uint32_t | read24 () override |
Reads 24 bits from the bus. | |
uint32_t | read32 () override |
Reads 32 bits from the bus. | |
void | read (uint8_t *data, size_t size) override |
Reads multiple bytes from the bus. | |
void | read16 (uint16_t *data, size_t size) override |
Reads multiple half words from the bus. | |
void | write (uint8_t data) override |
Writes 8 bits to the bus. | |
void | write16 (uint16_t data) override |
Writes 16 bits to the bus. | |
void | write24 (uint32_t data) override |
Writes 24 bits to the bus. | |
void | write32 (uint32_t data) override |
Writes 32 bits to the bus. | |
void | write (const uint8_t *data, size_t size) override |
Writes multiple bytes to the bus. | |
void | write16 (const uint16_t *data, size_t size) override |
Writes multiple half words to the bus. | |
uint8_t | transfer (uint8_t data) override |
Full duplex transmission of 8 bits on the bus. | |
uint16_t | transfer16 (uint16_t data) override |
Full duplex transmission of 16 bits on the bus. | |
uint32_t | transfer24 (uint32_t data) override |
Full duplex transmission of 24 bits on the bus. | |
uint32_t | transfer32 (uint32_t data) override |
Full duplex transmission of 32 bits on the bus. | |
void | transfer (uint8_t *data, size_t size) override |
Full duplex transmission of multiple bytes on the bus. | |
void | transfer16 (uint16_t *data, size_t size) override |
Full duplex transmission of multiple half words on the bus. | |
![]() | |
SPIBusInterface () | |
Delete copy/move constructors/operators. | |
SPIBusInterface (const SPIBusInterface &)=delete | |
SPIBusInterface & | operator= (const SPIBusInterface &)=delete |
SPIBusInterface (SPIBusInterface &&)=delete | |
SPIBusInterface & | operator= (SPIBusInterface &&)=delete |
Driver for STM32 low level SPI peripheral.
This driver applies to the whole STM32F4xx family.
The serial peripheral interface (SPI) allows half/full-duplex, synchronous, serial communication with external devices. The interface can be configured as the master and in this case it provides the communication clock (SCK) to the external slave device. The peripheral is also capable of reliable communication using CRC checking.
Supported SPI main features:
|
inline |
|
delete |
|
delete |
|
inlineoverridevirtual |
Configures and enables the bus with the provided configuration.
Since this implementation is not synchronized, if configure() is called on an already in use bus nothing will be done.
Use SyncedSPIBus if you need to synchronize access to the bus.
Implements Boardcore::SPIBusInterface.
|
inlineoverridevirtual |
See SPIBusInterface::deselect().
Implements Boardcore::SPIBusInterface.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Reads multiple bytes from the bus.
data | Buffer to be filled with received data. |
size | Size of the buffer. |
Implements Boardcore::SPIBusInterface.
|
inlineoverridevirtual |
Reads 16 bits from the bus.
Implements Boardcore::SPIBusInterface.
|
inlineoverridevirtual |
Reads multiple half words from the bus.
data | Buffer to be filled with received data. |
size | Size of the buffer. |
Implements Boardcore::SPIBusInterface.
|
inlineoverridevirtual |
Reads 24 bits from the bus.
Implements Boardcore::SPIBusInterface.
|
inlineoverridevirtual |
|
inline |
|
inlineoverridevirtual |
See SPIBusInterface::select().
Implements Boardcore::SPIBusInterface.
|
inline |
The SPI peripheral differs on stm32f7 microcontrollers. Refer to AN4660 for a comprehensive differences list between different peripherals versions.
The main difference here is that on the f7 you can transmit between 4 and 16. There is also a 32bit fifo and a threshold that generates the RXNE event. For this reason, on f7s we need to configure the 16 bit frame format differently and change the fifo threshold level.
|
inline |
|
inline |
|
inlineoverridevirtual |
Full duplex transmission of multiple bytes on the bus.
data | Buffer containing data to trasfer. |
size | Size of the buffer. |
Implements Boardcore::SPIBusInterface.
|
inlineoverridevirtual |
Full duplex transmission of 8 bits on the bus.
data | Byte to write. |
Implements Boardcore::SPIBusInterface.
|
inlineoverridevirtual |
Full duplex transmission of multiple half words on the bus.
data | Buffer containing data to trasfer. |
size | Size of the buffer. |
Implements Boardcore::SPIBusInterface.
|
inlineoverridevirtual |
Full duplex transmission of 16 bits on the bus.
data | Half word to write. |
Implements Boardcore::SPIBusInterface.
|
inlineoverridevirtual |
Full duplex transmission of 24 bits on the bus.
data | Bytes to write (the MSB of the uint32_t is not used). |
Implements Boardcore::SPIBusInterface.
|
inlineoverridevirtual |
Full duplex transmission of 32 bits on the bus.
data | Word to write. |
Implements Boardcore::SPIBusInterface.
|
inlineoverridevirtual |
Writes multiple bytes to the bus.
data | Buffer containing data to write. |
size | Size of the buffer. |
Implements Boardcore::SPIBusInterface.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Writes multiple half words to the bus.
data | Buffer containing data to write. |
size | Size of the buffer. |
Implements Boardcore::SPIBusInterface.
|
inlineoverridevirtual |
Writes 16 bits to the bus.
data | Half word to write. |
Implements Boardcore::SPIBusInterface.
|
inlineoverridevirtual |
Writes 24 bits to the bus.
data | Bytes to write (the MSB of the uint32_t is not used). |
Implements Boardcore::SPIBusInterface.
|
inlineoverridevirtual |