Data Structures | |
struct | KSPIConf |
struct | KSPI |
Macros | |
#define | K_NUM_SPI YOTTA_CFG_HARDWARE_SPICOUNT |
KubOS-HAL SPI Interface. More... | |
#define | DEFAULT_SPI YOTTA_CFG_HARDWARE_DEFAULTS_SPI |
Enumerations | |
enum | KSPINum { K_SPI1 = 0, K_SPI2 } |
enum | SPIRole { K_SPI_MASTER = 0, K_SPI_SLAVE } |
enum | SPIDirection { K_SPI_DIRECTION_2LINES = 0, K_SPI_DIRECTION_2LINES_RXONLY, K_SPI_DIRECTION_1LINE } |
enum | SPIDataSize { K_SPI_DATASIZE_8BIT = 0, K_SPI_DATASIZE_16BIT } |
enum | KSPIStatus { SPI_OK, SPI_ERROR, SPI_ERROR_TIMEOUT } |
Functions | |
void | k_spi_init (KSPINum spi, KSPIConf *conf) |
void | k_spi_terminate (KSPINum spi) |
KSPIStatus | k_spi_write (KSPINum spi, uint8_t *buffer, uint32_t len) |
KSPIStatus | k_spi_read (KSPINum spi, uint8_t *buffer, uint32_t len) |
KSPIStatus | k_spi_write_read (KSPINum spi, uint8_t *txBuffer, uint8_t *rxBuffer, uint32_t len) |
KSPI * | kprv_spi_get (KSPINum spi) |
KSPIStatus | kprv_spi_write (KSPINum spi, uint8_t *buffer, uint32_t len) |
KSPIStatus | kprv_spi_read (KSPINum spi, uint8_t *buffer, uint32_t len) |
KSPIStatus | kprv_spi_write_read (KSPINum spi, uint8_t *txBuffer, uint8_t *rxBuffer, uint32_t len) |
Macro Definition Documentation
#define DEFAULT_SPI YOTTA_CFG_HARDWARE_DEFAULTS_SPI |
#define K_NUM_SPI YOTTA_CFG_HARDWARE_SPICOUNT |
KubOS-HAL SPI Interface.
Enumeration Type Documentation
enum KSPINum |
enum KSPIStatus |
enum SPIDataSize |
enum SPIDirection |
enum SPIRole |
Function Documentation
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
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