Skyward boardcore
Loading...
Searching...
No Matches
Boardcore::SPI Namespace Reference

Driver for STM32 low level SPI peripheral. More...

Enumerations

enum class  Order : uint16_t { MSB_FIRST = 0 , LSB_FIRST = SPI_CR1_LSBFIRST }
 
enum class  ClockDivider : uint8_t {
  DIV_2 = 0x00 , DIV_4 = SPI_CR1_BR_0 , DIV_8 = SPI_CR1_BR_1 , DIV_16 = SPI_CR1_BR_1 | SPI_CR1_BR_0 ,
  DIV_32 = SPI_CR1_BR_2 , DIV_64 = SPI_CR1_BR_2 | SPI_CR1_BR_0 , DIV_128 = SPI_CR1_BR_2 | SPI_CR1_BR_1 , DIV_256 = SPI_CR1_BR
}
 SPI Clock divider. More...
 
enum class  Mode : uint8_t { MODE_0 = 0 , MODE_1 = SPI_CR1_CPHA , MODE_2 = SPI_CR1_CPOL , MODE_3 = SPI_CR1_CPOL | SPI_CR1_CPHA }
 
enum class  WriteBit { NORMAL , INVERTED , DISABLED }
 

Detailed Description

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.

SPI main features:

  • Full-duplex synchronous transfers on three lines
  • 8- or 16-bit transfer frame format selection
  • Master or slave operation
  • 8 master mode baud rate prescaler (f_PCLK/2 max.)
  • Programmable clock polarity and phase
  • Programmable data order with MSB-first or LSB-first shifting
  • Hardware CRC feature for reliable communication
  • DMA capability

Enumeration Type Documentation

◆ ClockDivider

enum class Boardcore::SPI::ClockDivider : uint8_t
strong

SPI Clock divider.

SPI clock frequency will be equal to the SPI peripheral bus clock speed divided by the specified value.

Eg: DIV_2 --> spi clock freq = f_PCLK / 2

Enumerator
DIV_2 
DIV_4 
DIV_8 
DIV_16 
DIV_32 
DIV_64 
DIV_128 
DIV_256 

Definition at line 69 of file SPIDefs.h.

◆ Mode

enum class Boardcore::SPI::Mode : uint8_t
strong
Enumerator
MODE_0 

CPOL = 0, CPHA = 0 -> Clock low when idle, sample on first edge.

CPOL = 0, CPHA = 1 -> Clock low when idle, sample on second edge

MODE_1 

CPOL = 1, CPHA = 0 -> Clock high when idle, sample on first edge.

MODE_2 

CPOL = 1, CPHA = 1 -> Clock high when idle, sample on second edge.

MODE_3 

Definition at line 81 of file SPIDefs.h.

◆ Order

enum class Boardcore::SPI::Order : uint16_t
strong
Enumerator
MSB_FIRST 
LSB_FIRST 

Definition at line 55 of file SPIDefs.h.

◆ WriteBit

enum class Boardcore::SPI::WriteBit
strong
Enumerator
NORMAL 

Normal write bit settings (0 for write, 1 for reads)

INVERTED 

Inverted write bit settings (1 for write, 0 for reads)

DISABLED 

Do not set write bit in any way.

Definition at line 93 of file SPIDefs.h.