![]() |
EVE 1.0
|
Driver for the MCU's SPI blocks. More...
#include <core/clk.h>
#include <lib/dlist.h>
#include <dev/data-buffer.h>
#include <dev/gpio.h>
#include <hal/nrf_spim.h>
Go to the source code of this file.
Data Structures | |
struct | spi_cs_t |
struct | spi_state_t |
struct | spi_t |
Macros | |
#define | ERRATA_58 |
#define | SPI_SYNC_FIFO_DEPTH 4 |
#define | SPI_CS_UNINITIALIZED ((struct spi_cs_t) { .CsUnInitialized = 1 }) |
Typedefs | |
typedef void(* | spi_async_callback_t) (const struct spi_t *Spi, void *CallbackData) |
Enumerations |
Functions called from application programs | |
static bool struct spi_cs_t ChipSelect uint32_t Baudrate struct work_t * | Work |
return | Ret |
void | SpiInit (const struct spi_t *Spi) |
Name: SpiInit Initializes SPI based on selected device. Master operation: Baudrate is limited to 0.5*peripheral clock. Slave operation: Not implemented. Called from main program level. More... | |
void | SpiDisable (const struct spi_t *Spi) |
Name: SpiDisable Disables SPI based on selected device. Called from main program level. More... | |
uint8_t | SpiRead (const struct spi_t *Spi) |
Name: SpiRead WARNING: SpiWrite() must be called prior to this function. Waits for data received in RX FIFO. More... | |
void | SpiWrite (const struct spi_t *Spi, uint8_t DataToSend) |
Name: SpiWrite WARNING: SpiCsEnable() must be called prior to this function. Waits for empty transmit buffer, then sends 1 byte. More... | |
uint8_t | SpiWriteRead (const struct spi_t *Spi, uint8_t DataToSend) |
Name: SpiWriteRead WARNING: SpiCsEnable() must be called prior to this function. Waits for empty transmit buffer, sends 1 byte and waits for data received in RX FIFO. More... | |
void | SpiTransferAsync (const struct spi_t *Spi, const void *TxBuffer, uint32_t TxLength, void *RxBuffer, uint32_t RxLength, spi_async_callback_t Callback, void *CallbackData) |
Name: SpiTransferAsync WARNING: SpiCsEnable() must be called prior to this function. Starts asynchronous data transfer (both transmit and receive). More... | |
void | SpiTransferSync (const struct spi_t *Spi, const void *TxBuffer, uint32_t TxLength, void *RxBuffer, uint32_t RxLength, uint32_t Flags) |
Name: SpiTransferSync WARNING: SpiCsEnable() must be called prior to this function. Does synchronous data transfer (both transmit and receive). More... | |
void | SpiFlush (const struct spi_t *Spi) |
Name: SpiFlush WARNING: SpiCsEnable() must be called prior to this function. Waits for any previously transmission to be complete, then flushes RX FIFO. More... | |
static bool | SpiIsBusy (const struct spi_t *Spi) |
Name: SpiIsBusy WARNING: SpiCsEnable() must be called prior to this function. Testes if transmitter is busy, i.e. if data in transmit buffer and/or shift register. More... | |
void | SpiCsInit (struct spi_cs_t ChipSelect, uint32_t MaxBaudrate) |
Name: SpiCsInit Initializes SPI chip select instance. Called once from main program level before first SpiCsEnable() use. More... | |
bool | SpiCsEnable (const struct spi_t *Spi, struct spi_cs_t ChipSelect, uint32_t Baudrate) |
Name: SpiCsEnable Enables peripheral clock for USART, updates SPI setting according to ChipSelect, and activates chip select pin. More... | |
void | SpiCsRegisterWait (const struct spi_t *Spi, struct work_t *Work) |
Name: SpiCsRegisterWait Registers a work to be executed when the SPI block becomes available. More... | |
static bool | __attribute__ ((warn_unused_result)) SpiCsWait(const struct spi_t *Spi |
Name: SpiCsWait Enables peripheral clock for USART, updates SPI setting according to ChipSelect, and activates chip select pin. More... | |
if (!Ret) SpiCsRegisterWait(Spi | |
void | SpiCsDisable (const struct spi_t *Spi, struct spi_cs_t ChipSelect) |
Name: SpiCsDisable Waits for any ongoing transmission to end, flush RX FIFO, disables chip select pin and disables peripheral clock for USART. More... | |
static bool | SpiCsIsActive (const struct spi_t *Spi, struct spi_cs_t ChipSelect) |
Name: SpiCsIsActive Checks that the given chip select is active. More... | |
void | SpiInterruptHandler (const struct spi_t *Spi) |
Name: SpiInterruptHandler SPI interrupt handler Called from board.c at hardware interrupt context. More... | |
Driver for the MCU's SPI blocks.
Definition in file spi.h.