modm API documentation
|
#include <modm/platform/spi/spi_hal_5.hpp>
Public Types | |
enum | DataMode : uint32_t { DataMode::Mode0 = 0b00, DataMode::Mode1 = SPI_CR1_CPHA, DataMode::Mode2 = SPI_CR1_CPOL, Mode3 = SPI_CR1_CPOL | SPI_CR1_CPHA, All = Mode3 } |
enum | DataOrder : uint32_t { MsbFirst = 0b0, LsbFirst = SPI_CR1_LSBFIRST, All = LsbFirst } |
enum | DataSize : uint32_t { Bit8 = 0, Bit16 = SPI_CR1_DFF, All = Bit16 } |
enum | Interrupt : uint32_t { RxBufferNotEmpty = SPI_CR2_RXNEIE, TxBufferEmpty = SPI_CR2_TXEIE, Error = SPI_CR2_ERRIE, RxDmaEnable = SPI_CR2_RXDMAEN, TxDmaEnable = SPI_CR2_TXDMAEN } |
enum | InterruptFlag : uint32_t { TxBufferEmpty = SPI_SR_TXE, RxBufferNotEmpty = SPI_SR_RXNE, CrcError = SPI_SR_CRCERR, ModeFaultError = SPI_SR_MODF, OverrunError = SPI_SR_OVR, Busy = SPI_SR_BSY, FrameFormatError = SPI_SR_FRE } |
enum | MasterSelection : uint32_t { Slave = 0, Master = SPI_CR1_MSTR, All = Master } |
enum | Prescaler : uint32_t { Div2 = 0, Div4 = SPI_CR1_BR_0, Div8 = SPI_CR1_BR_1, Div16 = SPI_CR1_BR_1 | SPI_CR1_BR_0, Div32 = SPI_CR1_BR_2, Div64 = SPI_CR1_BR_2 | SPI_CR1_BR_0, Div128 = SPI_CR1_BR_2 | SPI_CR1_BR_1, Div256 = SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0 } |
Public Member Functions | |
MODM_FLAGS32 (Interrupt) | |
MODM_FLAGS32 (InterruptFlag) | |
Static Public Member Functions | |
static void | enable () |
Enables the clock, resets the hardware and sets the SPE bit. | |
static void | disable () |
Disables the hw module (by disabling its clock line) | |
static void | initialize (Prescaler prescaler, MasterSelection masterSelection=MasterSelection::Master, DataMode dataMode=DataMode::Mode0, DataOrder dataOrder=DataOrder::MsbFirst, DataSize dataSize=DataSize::Bit8) |
static void | setDataMode (DataMode dataMode) |
static void | setDataOrder (DataOrder dataOrder) |
static void | setDataSize (DataSize dataSize) |
static void | setMasterSelection (MasterSelection masterSelection) |
static bool | isReceiveRegisterNotEmpty () |
Returns true if data has been received. | |
static bool | isTransmitRegisterEmpty () |
Returns true if data can be written. | |
static void | write (uint16_t data) |
static void | write (uint8_t data) |
static void | read (uint8_t &data) |
static void | read (uint16_t &data) |
static void | enableInterruptVector (bool enable, uint32_t priority) |
static void | enableInterrupt (Interrupt_t interrupt) |
static void | disableInterrupt (Interrupt_t interrupt) |
static InterruptFlag_t | getInterruptFlags () |
static void | acknowledgeInterruptFlag (InterruptFlag_t flags) |
static void | enableTransfer () |
static void | disableTransfer () |
Serial peripheral interface (SPI5)
Very basic implementation that exposes more hardware features than the regular Spi classes.
|
inheritedstrong |
|
static |
|
static |
|
static |
Returns the value of the data register
|
static |
Returns the value of the data register
|
static |
Write up to 16 Bit to the data register
|
static |
Write 8 Bit to the data register