![]() |
RUI3 (RAK Unified Interface 3) - RAK4631
|
Provide a hardware independent SPI master driver layer for API layer to use. More...
Go to the source code of this file.
Data Structures | |
struct | udrv_spimst_api |
Enumerations | |
enum | udrv_spimst_port { UDRV_SPIMST_0 = 0x0, UDRV_SPIMST_1 = 0x1, UDRV_SPIMST_2 = 0x2, UDRV_SPIMST_3 = 0x3, UDRV_SPIMST_MAX = 0x4 } |
enum | ENUM_SPI_MST_CPHA_T { SPI_MST_CPHA_0 = 0, SPI_MST_CPHA_1 = 1 } |
enum | ENUM_SPI_MST_CPOL_T { SPI_MST_CPOL_0 = 0, SPI_MST_CPOL_1 = 1 } |
Functions | |
void | udrv_spimst_init (udrv_spimst_port port) |
void | udrv_spimst_setup_mode (udrv_spimst_port port, ENUM_SPI_MST_CPHA_T CPHA, ENUM_SPI_MST_CPOL_T CPOL) |
void | udrv_spimst_setup_freq (udrv_spimst_port port, uint32_t clk_Hz) |
void | udrv_spimst_setup_byte_order (udrv_spimst_port port, bool msb_first) |
void | udrv_spimst_deinit (udrv_spimst_port port) |
int8_t | udrv_spimst_trx (udrv_spimst_port port, uint8_t *write_data, uint32_t write_length, uint8_t *read_data, uint32_t read_length, uint32_t csn) |
void | udrv_spimst_suspend () |
Suspend SPI master hardware before entering sleep mode. More... | |
void | udrv_spimst_resume () |
Resume SPI master hardware after leaving sleep mode. More... | |
Provide a hardware independent SPI master driver layer for API layer to use.
enum udrv_spimst_port |
enum ENUM_SPI_MST_CPHA_T |
enum ENUM_SPI_MST_CPOL_T |
void udrv_spimst_init | ( | udrv_spimst_port | port | ) |
Initilize SPI bus to enable SPI operations.
port | the specified serial port |
void udrv_spimst_setup_mode | ( | udrv_spimst_port | port, |
ENUM_SPI_MST_CPHA_T | CPHA, | ||
ENUM_SPI_MST_CPOL_T | CPOL | ||
) |
Setup SPI mode.
port | the specified serial port |
CPHA | Serial Clock Phase. 0x00 - Serial clock toggles in middle of first data bit 0x01 - Serial clock toggles at start of first data bit |
CPOL | Serial Clock Polarity. 0x00 - Inactive state of serial clock is low 0x01 - Inactive state of serial clock is high, need pull up in the clock pin. |
void udrv_spimst_setup_freq | ( | udrv_spimst_port | port, |
uint32_t | clk_Hz | ||
) |
Setup SPI frequency.
port | the specified serial port |
clk_Hz | SPI Clock (BUS 40MHz : 610 - 20M, BUS 80MHz : 1221 - 40MHzM) |
void udrv_spimst_setup_byte_order | ( | udrv_spimst_port | port, |
bool | msb_first | ||
) |
Setup SPI bit order.
port | the specified serial port |
msb_first | (true : most significant byte first, false : least significatn byte first) |
void udrv_spimst_deinit | ( | udrv_spimst_port | port | ) |
Deinitialize SPI bus to disable SPI operations
port | the specified serial port |
int8_t udrv_spimst_trx | ( | udrv_spimst_port | port, |
uint8_t * | write_data, | ||
uint32_t | write_length, | ||
uint8_t * | read_data, | ||
uint32_t | read_length, | ||
uint32_t | csn | ||
) |
Transmit and receive the spi data.
port | the specified serial port |
write_data | Pointer to the data buffer to be written by the master. |
write_length | Size of the write data buffer exposed to the SPI master. |
read_data | Pointer to the data buffer to be read by the master. |
read_length | Size of the read data buffer exposed to the SPI master. |
csn | Chip select pin. |
void udrv_spimst_suspend | ( | ) |
Suspend SPI master hardware before entering sleep mode.
void udrv_spimst_resume | ( | ) |
Resume SPI master hardware after leaving sleep mode.