Firmware SDK
|
Driver for SPI bus. More...
Enumerations | |
enum | twr_spi_speed_t { TWR_SPI_SPEED_125_KHZ = 0 , TWR_SPI_SPEED_250_KHZ = 1 , TWR_SPI_SPEED_500_KHZ = 2 , TWR_SPI_SPEED_1_MHZ = 3 , TWR_SPI_SPEED_2_MHZ = 4 , TWR_SPI_SPEED_4_MHZ = 5 , TWR_SPI_SPEED_8_MHZ = 6 , TWR_SPI_SPEED_16_MHZ = 7 } |
SPI communication speed. More... | |
enum | twr_spi_mode_t { TWR_SPI_MODE_0 = 0 , TWR_SPI_MODE_1 = 1 , TWR_SPI_MODE_2 = 2 , TWR_SPI_MODE_3 = 3 } |
SPI mode of operation. More... | |
enum | twr_spi_event_t { TWR_SPI_EVENT_DONE = 1 } |
SPI event. More... | |
Functions | |
void | twr_spi_init (twr_spi_speed_t speed, twr_spi_mode_t mode) |
Initialize SPI channel. More... | |
void | twr_spi_set_speed (twr_spi_speed_t speed) |
Set SPI communication speed. More... | |
void | twr_spi_set_timing (uint16_t cs_delay, uint16_t delay, uint16_t cs_quit) |
Set SPI timing. More... | |
twr_spi_speed_t | twr_spi_get_speed (void) |
Get SPI communication speed. More... | |
void | twr_spi_set_mode (twr_spi_mode_t mode) |
Set SPI mode of operation. More... | |
void | twr_spi_set_manual_cs_control (bool manual_cs_control) |
Enable manual control of CS pin. More... | |
twr_spi_mode_t | twr_spi_get_mode (void) |
Get SPI mode of operation. More... | |
bool | twr_spi_is_ready (void) |
Check if is ready for transfer. More... | |
bool | twr_spi_transfer (const void *source, void *destination, size_t length) |
Execute SPI transfer. More... | |
bool | twr_spi_async_transfer (const void *source, void *destination, size_t length, void(*event_handler)(twr_spi_event_t event, void *event_param), void(*event_param)) |
Execute async SPI transfer. More... | |
Driver for SPI bus.
enum twr_spi_event_t |
enum twr_spi_mode_t |
enum twr_spi_speed_t |
SPI communication speed.
bool twr_spi_async_transfer | ( | const void * | source, |
void * | destination, | ||
size_t | length, | ||
void(*)(twr_spi_event_t event, void *event_param) | event_handler, | ||
void * | event_param | ||
) |
Execute async SPI transfer.
[in] | source | Pointer to source buffer |
[out] | destination | Pointer to destination buffer |
[in] | length | Number of bytes to be transferred |
[in] | event_handler | Function address (can be NULL) |
[in] | event_param | Optional event parameter (can be NULL) |
Definition at line 267 of file twr_spi.c.
Referenced by twr_ls013b7dh03_update().
twr_spi_mode_t twr_spi_get_mode | ( | void | ) |
twr_spi_speed_t twr_spi_get_speed | ( | void | ) |
void twr_spi_init | ( | twr_spi_speed_t | speed, |
twr_spi_mode_t | mode | ||
) |
Initialize SPI channel.
[in] | speed | SPI communication speed |
[in] | mode | SPI mode of operation |
Definition at line 64 of file twr_spi.c.
Referenced by twr_ls013b7dh03_init().
bool twr_spi_is_ready | ( | void | ) |
Check if is ready for transfer.
Definition at line 187 of file twr_spi.c.
Referenced by twr_ls013b7dh03_is_ready(), and twr_ls013b7dh03_update().
void twr_spi_set_manual_cs_control | ( | bool | manual_cs_control | ) |
void twr_spi_set_mode | ( | twr_spi_mode_t | mode | ) |
Set SPI mode of operation.
[in] | mode | SPI mode of operation |
Definition at line 155 of file twr_spi.c.
Referenced by twr_spi_init().
void twr_spi_set_speed | ( | twr_spi_speed_t | speed | ) |
Set SPI communication speed.
[in] | speed | SPI communication speed |
Definition at line 119 of file twr_spi.c.
Referenced by twr_spi_init().
void twr_spi_set_timing | ( | uint16_t | cs_delay, |
uint16_t | delay, | ||
uint16_t | cs_quit | ||
) |
bool twr_spi_transfer | ( | const void * | source, |
void * | destination, | ||
size_t | length | ||
) |