Search Results
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... | |
KSPI * kprv_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... | |
Enumeration Type Documentation
enum KSPINum |
enum KSPIStatus |
enum SPIClockPhase |
enum SPIClockPolarity |
enum SPIDataSize |
enum SPIDirection |
enum SPIFirstBit |
enum SPIRole |
Function Documentation
KSPIConf k_spi_conf_defaults | ( | void | ) |
Setup and enable spi bus.
- Parameters
-
spi spi bus to initialize conf config values to initialize with
KSPIStatus k_spi_read | ( | KSPINum | spi, |
uint8_t * | buffer, | ||
uint32_t | len | ||
) |
Read data over spi bus.
In order to ensure safe spi sharing, this function is semaphore locked. There is one semaphore per bus. This function will block indefinitely while waiting for the semaphore.
- Parameters
-
spi spi bus to read from buffer pointer to data buffer len length of data to read
- Returns
- KSPIStatus SPI_OK on success, otherwise failure
void k_spi_terminate | ( | KSPINum | spi | ) |
Terminate spi bus.
- Parameters
-
spi spi bus to terminate
KSPIStatus k_spi_write | ( | KSPINum | spi, |
uint8_t * | buffer, | ||
uint32_t | len | ||
) |
Write data over spi bus.
In order to ensure safe spi sharing, this function is semaphore locked. There is one semaphore per bus. This function will block indefinitely while waiting for the semaphore.
- Parameters
-
spi spi bus to write to buffer pointer to data buffer len length of data to write
- Returns
- KSPIStatus SPI_OK on success, otherwise failure
KSPIStatus k_spi_write_read | ( | KSPINum | spi, |
uint8_t * | txBuffer, | ||
uint8_t * | rxBuffer, | ||
uint32_t | len | ||
) |
Write and read data over spi bus.
In order to ensure safe spi sharing, this function is semaphore locked. There is one semaphore per bus. This function will block indefinitely while waiting for the semaphore.
- Parameters
-
spi spi bus to write to txBuffer pointer to data buffer to write from rxBuffer pointer to data buffer to read into len length of data to write and read
- Returns
- KSPIStatus SPI_OK on success, otherwise failure
KSPIStatus kprv_spi_dev_init | ( | KSPINum | spi | ) |
Low level spi initialization.
This is implemented by the hardware specific hal
- Parameters
-
spi spi bus to initialize
- Returns
- KSPIStatus SPI_OK on success, otherwise failure
KSPIStatus kprv_spi_dev_terminate | ( | KSPINum | spi | ) |
Low level spi termination.
This is implemented by the hardware specific hal
- Parameters
-
spi spi bus to terminate
- Returns
- KSPIStatus SPI_OK on success, otherwise failure
Fetches spi bus data structure.
- Parameters
-
spi number of spi bus to fetch
- Returns
- KSPI* pointer to data structure
KSPIStatus kprv_spi_read | ( | KSPINum | spi, |
uint8_t * | buffer, | ||
uint32_t | len | ||
) |
Low level hal spi read.
This is implemented by the hardware specific hal
- Parameters
-
spi spi bus to read from buffer pointer to data buffer len length of data to read
- Returns
- KSPIStatus SPI_OK on success, otherwise failure
KSPIStatus kprv_spi_write | ( | KSPINum | spi, |
uint8_t * | buffer, | ||
uint32_t | len | ||
) |
Low level hal spi write.
This is implemented by the hardware specific hal
- Parameters
-
spi spi bus to write to buffer pointer to data buffer len length of data to write
- Returns
- KSPIStatus SPI_OK on success, otherwise failure
KSPIStatus kprv_spi_write_read | ( | KSPINum | spi, |
uint8_t * | txBuffer, | ||
uint8_t * | rxBuffer, | ||
uint32_t | len | ||
) |
Low level spi write & read.
This is implemented by the hardware specific hal
- Parameters
-
spi spi bus to write to txBuffer pointer to data buffer to write from rxBuffer pointer to data buffer to read into len length of data to write and read
- Returns
- KSPIStatus SPI_OK on success, otherwise failure