|
Firmware SDK
|
Driver for UART (universal asynchronous receiver/transmitter) More...
Enumerations | |
| enum | twr_uart_channel_t { TWR_UART_UART0 = 0 , TWR_UART_UART1 = 1 , TWR_UART_UART2 = 2 } |
| UART channels. More... | |
| enum | twr_uart_baudrate_t { TWR_UART_BAUDRATE_9600 = 0 , TWR_UART_BAUDRATE_19200 = 1 , TWR_UART_BAUDRATE_38400 = 2 , TWR_UART_BAUDRATE_57600 = 3 , TWR_UART_BAUDRATE_115200 = 4 , TWR_UART_BAUDRATE_921600 = 5 } |
| UART baudrate. More... | |
| enum | twr_uart_setting_t { TWR_UART_SETTING_8N1 = _TWR_UART_SETTING_DATA_BITS_8 | _TWR_UART_SETTING_PARITY_NONE | _TWR_UART_SETTING_STOP_BIT_1 , TWR_UART_SETTING_8E1 = _TWR_UART_SETTING_DATA_BITS_8 | _TWR_UART_SETTING_PARITY_EVEN | _TWR_UART_SETTING_STOP_BIT_1 , TWR_UART_SETTING_8O1 = _TWR_UART_SETTING_DATA_BITS_8 | _TWR_UART_SETTING_PARITY_ODD | _TWR_UART_SETTING_STOP_BIT_1 , TWR_UART_SETTING_8N2 = _TWR_UART_SETTING_DATA_BITS_8 | _TWR_UART_SETTING_PARITY_NONE | _TWR_UART_SETTING_STOP_BIT_2 , TWR_UART_SETTING_8E2 = _TWR_UART_SETTING_DATA_BITS_8 | _TWR_UART_SETTING_PARITY_EVEN | _TWR_UART_SETTING_STOP_BIT_2 , TWR_UART_SETTING_8O2 = _TWR_UART_SETTING_DATA_BITS_8 | _TWR_UART_SETTING_PARITY_NONE | _TWR_UART_SETTING_STOP_BIT_2 , TWR_UART_SETTING_8N1_5 = _TWR_UART_SETTING_DATA_BITS_8 | _TWR_UART_SETTING_PARITY_NONE | _TWR_UART_SETTING_STOP_BIT_15 , TWR_UART_SETTING_8E1_5 = _TWR_UART_SETTING_DATA_BITS_8 | _TWR_UART_SETTING_PARITY_EVEN | _TWR_UART_SETTING_STOP_BIT_15 , TWR_UART_SETTING_8O1_5 = _TWR_UART_SETTING_DATA_BITS_8 | _TWR_UART_SETTING_PARITY_NONE | _TWR_UART_SETTING_STOP_BIT_15 , TWR_UART_SETTING_7N1 = _TWR_UART_SETTING_DATA_BITS_7 | _TWR_UART_SETTING_PARITY_NONE | _TWR_UART_SETTING_STOP_BIT_1 , TWR_UART_SETTING_7E1 = _TWR_UART_SETTING_DATA_BITS_7 | _TWR_UART_SETTING_PARITY_EVEN | _TWR_UART_SETTING_STOP_BIT_1 , TWR_UART_SETTING_7O1 = _TWR_UART_SETTING_DATA_BITS_7 | _TWR_UART_SETTING_PARITY_ODD | _TWR_UART_SETTING_STOP_BIT_1 , TWR_UART_SETTING_7N2 = _TWR_UART_SETTING_DATA_BITS_7 | _TWR_UART_SETTING_PARITY_NONE | _TWR_UART_SETTING_STOP_BIT_2 , TWR_UART_SETTING_7E2 = _TWR_UART_SETTING_DATA_BITS_7 | _TWR_UART_SETTING_PARITY_EVEN | _TWR_UART_SETTING_STOP_BIT_2 , TWR_UART_SETTING_7O2 = _TWR_UART_SETTING_DATA_BITS_7 | _TWR_UART_SETTING_PARITY_NONE | _TWR_UART_SETTING_STOP_BIT_2 , TWR_UART_SETTING_7N1_5 = _TWR_UART_SETTING_DATA_BITS_7 | _TWR_UART_SETTING_PARITY_NONE | _TWR_UART_SETTING_STOP_BIT_15 , TWR_UART_SETTING_7E1_5 = _TWR_UART_SETTING_DATA_BITS_7 | _TWR_UART_SETTING_PARITY_EVEN | _TWR_UART_SETTING_STOP_BIT_15 , TWR_UART_SETTING_7O1_5 = _TWR_UART_SETTING_DATA_BITS_7 | _TWR_UART_SETTING_PARITY_NONE | _TWR_UART_SETTING_STOP_BIT_15 } |
| UART setting. More... | |
| enum | twr_uart_event_t { TWR_UART_EVENT_ASYNC_WRITE_DONE = 0 , TWR_UART_EVENT_ASYNC_READ_DATA = 1 , TWR_UART_EVENT_ASYNC_READ_TIMEOUT = 2 } |
| Callback events. More... | |
Functions | |
| void | twr_uart_init (twr_uart_channel_t channel, twr_uart_baudrate_t baudrate, twr_uart_setting_t setting) |
| Initialize UART channel. More... | |
| void | twr_uart_deinit (twr_uart_channel_t channel) |
| Deinitialize UART channel. More... | |
| size_t | twr_uart_write (twr_uart_channel_t channel, const void *buffer, size_t length) |
| Write data to UART channel (blocking call) More... | |
| size_t | twr_uart_read (twr_uart_channel_t channel, void *buffer, size_t length, twr_tick_t timeout) |
| Read data from UART channel (blocking call) More... | |
| void | twr_uart_set_event_handler (twr_uart_channel_t channel, void(*event_handler)(twr_uart_channel_t, twr_uart_event_t, void *), void *event_param) |
| Set callback function. More... | |
| void | twr_uart_set_async_fifo (twr_uart_channel_t channel, twr_fifo_t *write_fifo, twr_fifo_t *read_fifo) |
| Set buffers for async transfers. More... | |
| size_t | twr_uart_async_write (twr_uart_channel_t channel, const void *buffer, size_t length) |
| Add data to be transmited in async mode. More... | |
| bool | twr_uart_async_read_start (twr_uart_channel_t channel, twr_tick_t timeout) |
| Start async reading. More... | |
| bool | twr_uart_async_read_cancel (twr_uart_channel_t channel) |
| Cancel async reading. More... | |
| size_t | twr_uart_async_read (twr_uart_channel_t channel, void *buffer, size_t length) |
| Get data that has been received in async mode. More... | |
Driver for UART (universal asynchronous receiver/transmitter)
| enum twr_uart_baudrate_t |
UART baudrate.
Definition at line 28 of file twr_uart.h.
| enum twr_uart_channel_t |
UART channels.
| Enumerator | |
|---|---|
| TWR_UART_UART0 | UART channel UART0. |
| TWR_UART_UART1 | UART channel UART1. |
| TWR_UART_UART2 | UART channel UART2. |
Definition at line 13 of file twr_uart.h.
| enum twr_uart_event_t |
Callback events.
| Enumerator | |
|---|---|
| TWR_UART_EVENT_ASYNC_WRITE_DONE | Event is writting done. |
| TWR_UART_EVENT_ASYNC_READ_DATA | Event is reading done. |
| TWR_UART_EVENT_ASYNC_READ_TIMEOUT | Event is timeout. |
Definition at line 127 of file twr_uart.h.
| enum twr_uart_setting_t |
UART setting.
Definition at line 67 of file twr_uart.h.
| size_t twr_uart_async_read | ( | twr_uart_channel_t | channel, |
| void * | buffer, | ||
| size_t | length | ||
| ) |
Get data that has been received in async mode.
| [in] | channel | UART channel |
| [in] | buffer | Pointer to buffer |
| [in] | length | Maximum length of received data |
Definition at line 561 of file twr_uart.c.

| bool twr_uart_async_read_cancel | ( | twr_uart_channel_t | channel | ) |
Cancel async reading.
| [in] | channel | UART channel |
Definition at line 521 of file twr_uart.c.
Referenced by twr_uart_deinit().


| bool twr_uart_async_read_start | ( | twr_uart_channel_t | channel, |
| twr_tick_t | timeout | ||
| ) |
Start async reading.
| [in] | channel | UART channel |
| [in] | timeout | Maximum timeout in ms |
Definition at line 465 of file twr_uart.c.
Referenced by twr_cmwx1zzabz_init(), twr_td1207r_init(), and twr_wssfm10r1at_init().


| size_t twr_uart_async_write | ( | twr_uart_channel_t | channel, |
| const void * | buffer, | ||
| size_t | length | ||
| ) |
Add data to be transmited in async mode.
| [in] | channel | UART channel |
| [in] | buffer | Pointer to buffer |
| [in] | length | Length of data to be added |
Definition at line 418 of file twr_uart.c.

| void twr_uart_deinit | ( | twr_uart_channel_t | channel | ) |
Deinitialize UART channel.
| [in] | channel | UART channel |
Definition at line 237 of file twr_uart.c.
Referenced by twr_cmwx1zzabz_deinit().


| void twr_uart_init | ( | twr_uart_channel_t | channel, |
| twr_uart_baudrate_t | baudrate, | ||
| twr_uart_setting_t | setting | ||
| ) |
Initialize UART channel.
| [in] | channel | UART channel |
| [in] | config | UART configuration |
Definition at line 54 of file twr_uart.c.
Referenced by twr_cmwx1zzabz_init(), twr_log_init(), twr_td1207r_init(), and twr_wssfm10r1at_init().


| size_t twr_uart_read | ( | twr_uart_channel_t | channel, |
| void * | buffer, | ||
| size_t | length, | ||
| twr_tick_t | timeout | ||
| ) |
Read data from UART channel (blocking call)
| [in] | channel | UART channel |
| [in] | buffer | Pointer to destination buffer |
| [in] | length | Number of bytes to be read |
| [in] | timeout | Read operation timeout in ticks |
Definition at line 362 of file twr_uart.c.

| void twr_uart_set_async_fifo | ( | twr_uart_channel_t | channel, |
| twr_fifo_t * | write_fifo, | ||
| twr_fifo_t * | read_fifo | ||
| ) |
Set buffers for async transfers.
| [in] | channel | UART channel |
| [in] | write_fifo | Pointer to writing fifo |
| [in] | read_fifo | Pointer to reader fifo |
Definition at line 412 of file twr_uart.c.
Referenced by twr_cmwx1zzabz_init(), twr_td1207r_init(), and twr_wssfm10r1at_init().

| void twr_uart_set_event_handler | ( | twr_uart_channel_t | channel, |
| void(*)(twr_uart_channel_t, twr_uart_event_t, void *) | event_handler, | ||
| void * | event_param | ||
| ) |
Set callback function.
| [in] | channel | UART channel |
| [in] | event_handler | Function address |
| [in] | event_param | Optional event parameter (can be NULL) |
Definition at line 406 of file twr_uart.c.
Referenced by twr_cmwx1zzabz_init().

| size_t twr_uart_write | ( | twr_uart_channel_t | channel, |
| const void * | buffer, | ||
| size_t | length | ||
| ) |
Write data to UART channel (blocking call)
| [in] | channel | UART channel |
| [in] | buffer | Pointer to source buffer |
| [in] | length | Number of bytes to be written |
Definition at line 314 of file twr_uart.c.
Referenced by twr_atci_print(), twr_atci_print_buffer_as_hex(), twr_atci_printf(), twr_atci_printfln(), twr_atci_println(), twr_atci_write_error(), and twr_atci_write_ok().
