nRF5 SDK v17.1.0
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
libUARTE driver

Module for reliable communication over UARTE. More...

Modules

 libUARTE library configuration
 

Data Structures

struct  nrf_libuarte_drv_data_t
 
struct  nrf_libuarte_drv_overrun_err_evt_t
 
struct  nrf_libuarte_drv_evt_t
 
struct  nrf_libuarte_drv_config_t
 
struct  nrf_libuarte_drv_ctrl_blk_t
 
struct  nrf_libuarte_drv_t
 

Macros

#define NRF_LIBUARTE_DRV_HWFC_BYTE_LIMIT   4
 
#define NRF_LIBUARTE_DRV_DEFINE(_name, _uarte_idx, _timer_idx)
 

Typedefs

typedef void(* nrf_libuarte_drv_evt_handler_t )(void *context, nrf_libuarte_drv_evt_t *p_evt)
 

Enumerations

enum  nrf_libuarte_drv_evt_type_t {
  NRF_LIBUARTE_DRV_EVT_RX_DATA,
  NRF_LIBUARTE_DRV_EVT_RX_BUF_REQ,
  NRF_LIBUARTE_DRV_EVT_TX_DONE,
  NRF_LIBUARTE_DRV_EVT_ERROR,
  NRF_LIBUARTE_DRV_EVT_OVERRUN_ERROR
}
 
enum  nrf_libuarte_drv_ppi_channel_t {
  NRF_LIBUARTE_DRV_PPI_CH_EXT_TRIGGER_STARTRX_EN_ENDRX_STARTX,
  NRF_LIBUARTE_DRV_PPI_CH_RXSTARTED_EXT_TSK,
  NRF_LIBUARTE_DRV_PPI_CH_EXT_STOP_STOPRX,
  NRF_LIBUARTE_DRV_PPI_CH_EXT_STOP_GROUPS_EN,
  NRF_LIBUARTE_DRV_PPI_CH_RXRDY_TIMER_COUNT,
  NRF_LIBUARTE_DRV_PPI_CH_ENDRX_STARTRX,
  NRF_LIBUARTE_DRV_PPI_CH_ENDRX_EXT_TSK,
  NRF_LIBUARTE_DRV_PPI_CH_RTS_PIN,
  NRF_LIBUARTE_DRV_PPI_CH_RX_MAX,
  NRF_LIBUARTE_DRV_PPI_CH_RX_GROUP_MAX = NRF_LIBUARTE_DRV_PPI_CH_RX_MAX,
  NRF_LIBUARTE_DRV_PPI_CH_ENDTX_STARTTX = NRF_LIBUARTE_DRV_PPI_CH_RX_GROUP_MAX,
  NRF_LIBUARTE_DRV_PPI_CH_MAX
}
 PPI channels used by libuarte.
 
enum  nrf_libuarte_drv_ppi_group_t {
  NRF_LIBUARTE_DRV_PPI_GROUP_ENDRX_STARTRX,
  NRF_LIBUARTE_DRV_PPI_GROUP_ENDRX_EXT_RXDONE_TSK,
  NRF_LIBUARTE_DRV_PPI_GROUP_MAX
}
 PPI groups used by libuarte. More...
 

Functions

ret_code_t nrf_libuarte_drv_init (const nrf_libuarte_drv_t *const p_libuarte, nrf_libuarte_drv_config_t *p_config, nrf_libuarte_drv_evt_handler_t evt_handler, void *context)
 Function for initializing the libUARTE library. More...
 
void nrf_libuarte_drv_uninit (const nrf_libuarte_drv_t *const p_libuarte)
 Function for uninitializing the libUARTE library. More...
 
ret_code_t nrf_libuarte_drv_tx (const nrf_libuarte_drv_t *const p_libuarte, uint8_t *p_data, size_t len)
 Function for sending data over UARTE using EasyDMA. More...
 
ret_code_t nrf_libuarte_drv_rx_start (const nrf_libuarte_drv_t *const p_libuarte, uint8_t *p_data, size_t len, bool ext_trigger_en)
 Function for starting receiving data with additional configuration of external trigger to start receiving. More...
 
void nrf_libuarte_drv_rx_buf_rsp (const nrf_libuarte_drv_t *const p_libuarte, uint8_t *p_data, size_t len)
 Function for setting a buffer for data that will be later received in UARTE. More...
 
void nrf_libuarte_drv_rx_stop (const nrf_libuarte_drv_t *const p_libuarte)
 Function for stopping receiving data over UARTE. More...
 
void nrf_libuarte_drv_rts_clear (const nrf_libuarte_drv_t *const p_libuarte)
 Function for deasserting RTS to pause the transmission. More...
 
void nrf_libuarte_drv_rts_set (const nrf_libuarte_drv_t *const p_libuarte)
 Function for asserting RTS to restart the transmission. More...
 

Variables

const IRQn_Type libuarte_irqn []
 

Detailed Description

Module for reliable communication over UARTE.

Macro Definition Documentation

#define NRF_LIBUARTE_DRV_DEFINE (   _name,
  _uarte_idx,
  _timer_idx 
)
Value:
STATIC_ASSERT(_uarte_idx < UARTE_COUNT, "UARTE instance not present");\
STATIC_ASSERT(CONCAT_2(NRF_LIBUARTE_DRV_UARTE,_uarte_idx) == 1, "UARTE instance not enabled");\
STATIC_ASSERT(CONCAT_3(NRFX_TIMER,_timer_idx, _ENABLED) == 1, "Timer instance not enabled");\
static nrf_libuarte_drv_ctrl_blk_t CONCAT_2(_name, ctrl_blk); \
static const nrf_libuarte_drv_t _name = { \
.ctrl_blk = &CONCAT_2(_name, ctrl_blk), \
.timer = NRFX_TIMER_INSTANCE(_timer_idx), \
.uarte = CONCAT_2(NRF_UARTE, _uarte_idx),\
}

Enumeration Type Documentation

Enumerator
NRF_LIBUARTE_DRV_EVT_RX_DATA 

Data received.

NRF_LIBUARTE_DRV_EVT_RX_BUF_REQ 

Requesting new buffer for receiving data.

NRF_LIBUARTE_DRV_EVT_TX_DONE 

Requested TX transfer completed.

NRF_LIBUARTE_DRV_EVT_ERROR 

Error reported by the UARTE peripheral.

NRF_LIBUARTE_DRV_EVT_OVERRUN_ERROR 

Error reported by the driver.

PPI groups used by libuarte.

Enumerator
NRF_LIBUARTE_DRV_PPI_GROUP_ENDRX_STARTRX 

Group used for controlling PPI connection between ENDRX and STARTRX.

NRF_LIBUARTE_DRV_PPI_GROUP_ENDRX_EXT_RXDONE_TSK 

Group used for controlling PPI connection between ENDRX and RXDONE.

Function Documentation

ret_code_t nrf_libuarte_drv_init ( const nrf_libuarte_drv_t *const  p_libuarte,
nrf_libuarte_drv_config_t p_config,
nrf_libuarte_drv_evt_handler_t  evt_handler,
void *  context 
)

Function for initializing the libUARTE library.

Parameters
[in]p_libuartePointer to libuarte instance.
[in]p_configPointer to the structure with initial configuration.
[in]evt_handlerEvent handler provided by the user. Must not be NULL.
[in]contextUser context passed in the callback.
Returns
NRF_SUCCESS when properly initialized. NRF_ERROR_INTERNAL otherwise.
void nrf_libuarte_drv_rts_clear ( const nrf_libuarte_drv_t *const  p_libuarte)

Function for deasserting RTS to pause the transmission.

Flow control must be enabled.

Parameters
p_libuartePointer to libuarte instance.
void nrf_libuarte_drv_rts_set ( const nrf_libuarte_drv_t *const  p_libuarte)

Function for asserting RTS to restart the transmission.

Flow control must be enabled.

Parameters
p_libuartePointer to libuarte instance.
void nrf_libuarte_drv_rx_buf_rsp ( const nrf_libuarte_drv_t *const  p_libuarte,
uint8_t *  p_data,
size_t  len 
)

Function for setting a buffer for data that will be later received in UARTE.

Parameters
p_libuartePointer to libuarte instance.
p_dataPointer to data.
lenNumber of bytes to receive. Maximum possible length is dependent on the used SoC (see the MAXCNT register description in the Product Specification). The library checks it with an assertion.
ret_code_t nrf_libuarte_drv_rx_start ( const nrf_libuarte_drv_t *const  p_libuarte,
uint8_t *  p_data,
size_t  len,
bool  ext_trigger_en 
)

Function for starting receiving data with additional configuration of external trigger to start receiving.

Parameters
p_libuartePointer to libuarte instance.
p_dataPointer to data.
lenNumber of bytes to receive. Maximum possible length is dependent on the used SoC (see the MAXCNT register description in the Product Specification). The library checks it with an assertion.
ext_trigger_enTrue to disable immediate start.
Return values
NRF_ERROR_INTERNALError during PPI channel configuration.
NRF_SUCCESSBuffer set for receiving.
void nrf_libuarte_drv_rx_stop ( const nrf_libuarte_drv_t *const  p_libuarte)

Function for stopping receiving data over UARTE.

Parameters
p_libuartePointer to libuarte instance.
ret_code_t nrf_libuarte_drv_tx ( const nrf_libuarte_drv_t *const  p_libuarte,
uint8_t *  p_data,
size_t  len 
)

Function for sending data over UARTE using EasyDMA.

Parameters
[in]p_libuartePointer to libuarte instance.
[in]p_dataPointer to data.
[in]lenNumber of bytes to send.
Return values
NRF_ERROR_BUSYData is transferring.
NRF_ERROR_INTERNALError during PPI channel configuration.
NRF_SUCCESSBuffer set for sending.
void nrf_libuarte_drv_uninit ( const nrf_libuarte_drv_t *const  p_libuarte)

Function for uninitializing the libUARTE library.

Parameters
[in]p_libuartePointer to libuarte instance.

Documentation feedback | Developer Zone | Subscribe | Updated