rfLPC
A low level library for using NXP's LPC17xx SoC. Config is given for MBED prototyping board
|
SPI device driver. More...
Go to the source code of this file.
Macros | |
#define | RFLPC_SPI_CPOL_RISING_EDGE 0 |
Configure SCL to generate a rising edge clock. More... | |
#define | RFLPC_SPI_CPOL_FALLING_EDGE 2 |
Configure SCL to generate a falling edge clock. More... | |
#define | RFLPC_SPI_CPHA_PHASE_PIOR_TO_FIRST_EDGE 0 |
Transmit data before first clock edge. More... | |
#define | RFLPC_SPI_CPHA_PHASE_FIRST_EDGE 1 |
Transmit data at first clock edge. More... | |
Enumerations | |
enum | rflpc_spi_t { RFLPC_SPI0, RFLPC_SPI1 } |
Used to select which SPI port to use. More... | |
enum | rflpc_spi_mode_t { RFLPC_SPI_MASTER, RFLPC_SPI_SLAVE } |
Used to select the SPI operating mode. More... | |
Functions | |
void | rflpc_spi_init (rflpc_spi_t port, rflpc_spi_mode_t mode, rflpc_clock_divider_t cpu_clock_divider, uint8_t data_size_transfert, uint8_t clock_prescale, uint8_t serial_clock_rate, uint8_t clock_polarity_phase) |
Inits the SPI interface in master mode. More... | |
static LPC_SSP_TypeDef * | rflpc_spi_get_base_addr (rflpc_spi_t port) |
Returns the base address of the SPI control block depending of the desired port. More... | |
static int | rflpc_spi_tx_fifo_empty (rflpc_spi_t port) |
Tests if transmition FIFO is empty. More... | |
static int | rflpc_spi_idle (rflpc_spi_t port) |
Test if the spi is idle (nor transmiting neither receiving) This is useful when you need to handle CS by hand. More... | |
static int | rflpc_spi_tx_fifo_full (rflpc_spi_t port) |
Tests if the transmition FIFO is full. More... | |
static int | rflpc_spi_rx_fifo_empty (rflpc_spi_t port) |
Tests if the reception FIFO is empty. More... | |
static void | rflpc_spi_write (rflpc_spi_t port, uint16_t data) |
Sends data through the spi interface. More... | |
static uint16_t | rflpc_spi_read (rflpc_spi_t port) |
Receive data through the spi interface. More... | |
void | rflpc_spi_set_rx_callback (rflpc_spi_t port, rflpc_irq_handler_t callback) |
Sets the interrupt handler for SPI reception. More... | |
SPI device driver.
Definition in file spi.h.