Module for reliable communication over UARTE.
More...
|
#define | NRF_LIBUARTE_ASYNC_WITH_APP_TIMER 0 |
|
#define | NRF_LIBUARTE_PERIPHERAL_NOT_USED 255 |
|
#define | LIBUARTE_ASYNC_DEBRACKET(...) __VA_ARGS__ |
|
#define | __LIBUARTE_ASYNC_ARG_2(ignore_this, val,...) val |
|
#define | __LIBUARTE_ASYNC_ARG_2_DEBRACKET(ignore_this, val,...) LIBUARTE_ASYNC_DEBRACKET val |
|
#define | _LIBUARTE_ASYNC_EVAL(_eval_flag, _iftrue, _iffalse) _LIBUARTE_ASYNC_EVAL1(_eval_flag, _iftrue, _iffalse) |
|
#define | _LIBUARTE_ASYNC_EVAL1(_eval_flag, _iftrue, _iffalse) _LIBUARTE_ASYNC_EVAL2(_LIBUARTE_ASYNC_ZZZZ##_eval_flag, _iftrue, _iffalse) |
|
#define | _LIBUARTE_ASYNC_ZZZZ1 _LIBUARTE_ASYNC_YYYY, |
|
#define | _LIBUARTE_ASYNC_EVAL2(one_or_two_args, _iftrue, _iffalse) __LIBUARTE_ASYNC_ARG_2_DEBRACKET(one_or_two_args _iftrue, _iffalse) |
|
#define | NRF_LIBUARTE_ASYNC_DEFINE(_name, _uarte_idx, _timer0_idx, _rtc1_idx, _timer1_idx, _rx_buf_size, _rx_buf_cnt) |
| Macro for creating instance of libuarte_async. More...
|
|
Module for reliable communication over UARTE.
#define NRF_LIBUARTE_ASYNC_DEFINE |
( |
|
_name, |
|
|
|
_uarte_idx, |
|
|
|
_timer0_idx, |
|
|
|
_rtc1_idx, |
|
|
|
_timer1_idx, |
|
|
|
_rx_buf_size, |
|
|
|
_rx_buf_cnt |
|
) |
| |
Macro for creating instance of libuarte_async.
Libuarte_async requires one timer-like peripheral (RTC or TIMER) for triggering RX timeout. Macro will create instance only for peripheral which is used.
- Parameters
-
_name | Instance name. |
_uarte_idx | UARTE instance used. |
_timer0_idx | TIMER instance used by libuarte for bytes counting. |
_rtc1_idx | RTC instance used for timeout. If set to NRF_LIBUARTE_PERIPHERAL_NOT_USED then TIMER instance is used or app_timer instance if _timer1_idx is also set to NRF_LIBUARTE_PERIPHERAL_NOT_USED. |
_timer1_idx | TIMER instance used for timeout. If set to NRF_LIBUARTE_PERIPHERAL_NOT_USED then RTC instance is used or app_timer instance if _rtc1_idx is also set to NRF_LIBUARTE_PERIPHERAL_NOT_USED. |
_rx_buf_size | Size of single RX buffer. Size impacts accepted latency between buffer request and providing next buffer. Next must be provided within before _rx_buf_size bytes is received. |
_rx_buf_cnt | Number of buffers in the RX buffer pool. Size impacts accepted latency between NRF_LIBUARTE_ASYNC_EVT_RX_DATA event and nrf_libuarte_async_rx_free. |
Interrupt event handler.
- Parameters
-
[in] | p_evt | Pointer to event structure. Event is allocated on the stack so it is available only within the context of the event handler. |
Types of libuarte driver events.
Enumerator |
---|
NRF_LIBUARTE_ASYNC_EVT_RX_DATA |
Requested TX transfer completed.
|
NRF_LIBUARTE_ASYNC_EVT_TX_DONE |
Requested RX transfer completed.
|
NRF_LIBUARTE_ASYNC_EVT_ERROR |
Error reported by UARTE peripheral.
|
NRF_LIBUARTE_ASYNC_EVT_OVERRUN_ERROR |
Error reported by the driver.
|
Function for enabling receiver.
- Parameters
-
p_libuarte | Libuarte_async instance. |
Function for initializing the libuarte async library.
- Parameters
-
[in] | p_libuarte | Libuarte_async instance. |
[in] | p_config | Pointer to the structure with initial configuration. |
[in] | evt_handler | Event handler provided by the user. Must not be NULL. |
[in] | context | User context passed to the event handler. |
- Returns
- NRF_SUCCESS when properly initialized. NRF_ERROR_INTERNAL otherwise.
Function for deasserting RTS to pause the transmission.
Flow control must be enabled.
- Parameters
-
p_libuarte | Libuarte_async instance. |
Function for asserting RTS to restart the transmission.
Flow control must be enabled.
- Parameters
-
p_libuarte | Libuarte_async instance. |
void nrf_libuarte_async_rx_free |
( |
const nrf_libuarte_async_t *const |
p_libuarte, |
|
|
uint8_t * |
p_data, |
|
|
size_t |
length |
|
) |
| |
Function for deallocating received buffer data.
- Parameters
-
[in] | p_libuarte | Libuarte_async instance. |
[in] | p_data | Pointer to data. |
[in] | length | Number of bytes to free. |
Function for sending data asynchronously over UARTE.
- Parameters
-
[in] | p_libuarte | Libuarte_async instance. |
[in] | p_data | Pointer to data. |
[in] | length | Number of bytes to send. Maximum possible length is dependent on the used SoC (see the MAXCNT register description in the Product Specification). The library checks it with assertion. |
- Return values
-
NRF_ERROR_BUSY | Data is transferring. |
NRF_ERROR_INTERNAL | Error during configuration. |
NRF_SUCCESS | Buffer set for sending. |
Function for uninitializing the libuarte async library.
- Parameters
-
[in] | p_libuarte | Libuarte_async instance. |