spi.h File Reference

Go to the source code of this file.

Data Structures

struct  KSPIConf
 Spi configuration structure. More...
 
struct  KSPI
 Spi bus data structure. More...
 

Enumerations

enum  KSPINum { K_SPI_NO_BUS = 0, K_SPI1, K_SPI2, K_SPI3 }
 Available spi buses. More...
 
enum  SPIRole { K_SPI_MASTER = 0, K_SPI_SLAVE }
 Expected role of spi bus. More...
 
enum  SPIDirection { K_SPI_DIRECTION_2LINES = 0, K_SPI_DIRECTION_2LINES_RXONLY, K_SPI_DIRECTION_1LINE }
 Spi direction mode. More...
 
enum  SPIDataSize { K_SPI_DATASIZE_8BIT = 0, K_SPI_DATASIZE_16BIT }
 Spi data size. More...
 
enum  SPIClockPolarity { K_SPI_CPOL_LOW = 0, K_SPI_CPOL_HIGH }
 Spi clock polarity. More...
 
enum  SPIClockPhase { K_SPI_CPHA_1EDGE = 0, K_SPI_CPHA_2EDGE }
 Spi clock phase. More...
 
enum  SPIFirstBit { K_SPI_FIRSTBIT_MSB = 0, K_SPI_FIRSTBIT_LSB }
 Spi first bit order/endianess. More...
 
enum  KSPIStatus {
  SPI_OK, SPI_ERROR, SPI_ERROR_BUSY, SPI_ERROR_TIMEOUT,
  SPI_ERROR_NULL_HANDLE, SPI_ERROR_CONFIG
}
 Spi status values. More...
 

Functions

void k_spi_init (KSPINum spi, KSPIConf *conf)
 Setup and enable spi bus. More...
 
void k_spi_terminate (KSPINum spi)
 Terminate spi bus. More...
 
KSPIConf k_spi_conf_defaults (void)
 
KSPIStatus k_spi_write (KSPINum spi, uint8_t *buffer, uint32_t len)
 Write data over spi bus. More...
 
KSPIStatus k_spi_read (KSPINum spi, uint8_t *buffer, uint32_t len)
 Read data over spi bus. More...
 
KSPIStatus k_spi_write_read (KSPINum spi, uint8_t *txBuffer, uint8_t *rxBuffer, uint32_t len)
 Write and read data over spi bus. More...
 
KSPIkprv_spi_get (KSPINum spi)
 Fetches spi bus data structure. More...
 
KSPIStatus kprv_spi_write (KSPINum spi, uint8_t *buffer, uint32_t len)
 Low level hal spi write. More...
 
KSPIStatus kprv_spi_read (KSPINum spi, uint8_t *buffer, uint32_t len)
 Low level hal spi read. More...
 
KSPIStatus kprv_spi_write_read (KSPINum spi, uint8_t *txBuffer, uint8_t *rxBuffer, uint32_t len)
 Low level spi write & read. More...
 
KSPIStatus kprv_spi_dev_init (KSPINum spi)
 Low level spi initialization. More...
 
KSPIStatus kprv_spi_dev_terminate (KSPINum spi)
 Low level spi termination. More...