UARTE HALY

group nrfy_uarte

Hardware access layer with cache and barrier support for managing the UARTE peripheral.

Functions

NRFY_STATIC_INLINE void nrfy_uarte_periph_configure(NRF_UARTE_Type *p_reg, nrfy_uarte_config_t const *p_config)

Function for configuring the UARTE.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_config[in] Pointer to the peripheral configuration structure.

NRFY_STATIC_INLINE void nrfy_uarte_int_init(NRF_UARTE_Type *p_reg, uint32_t mask, uint8_t irq_priority, bool enable)

Function for initializing the specified UARTE interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be initialized.

  • irq_priority[in] Interrupt priority.

  • enable[in] True if interrupts associated with the event mask are to be enabled, false otherwise.

NRFY_STATIC_INLINE void nrfy_uarte_int_uninit(NRF_UARTE_Type *p_reg)

Function for uninitializing the UARTE interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

NRFY_STATIC_INLINE uint32_t nrfy_uarte_events_process(NRF_UARTE_Type *p_reg, uint32_t mask, nrfy_uarte_buffer_t const *p_xfer)

Function for processing the specified UARTE events.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of events to be processed, created by NRFY_EVENT_TO_INT_BITMASK().

  • p_xfer[in] Pointer to the structure containing buffer associated with the last reception. Can be NULL.

Returns:

Mask of events that were generated and processed. To be checked against the result of NRFY_EVENT_TO_INT_BITMASK().

NRFY_STATIC_INLINE void nrfy_uarte_tx_abort(NRF_UARTE_Type *p_reg, bool wait)

Function for aborting the ongoing UARTE transmission.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • wait[in] True if CPU should wait for peripheral to abort transmission, false otherwise.

NRFY_STATIC_INLINE void nrfy_uarte_stop(NRF_UARTE_Type *p_reg, nrfy_uarte_buffer_t const *p_xfer)

Function for stopping the UARTE transmitter and receiver.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_xfer[in] Pointer to the structure containing reception buffer. Can be NULL.

NRFY_STATIC_INLINE uint32_t nrfy_uarte_tx_start(NRF_UARTE_Type *p_reg, bool wait)

Function for starting the UARTE transmission.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • wait[in] True for blocking transmission, false otherwise.

Returns:

Mask of events occured, created by NRFY_EVENT_TO_INT_BITMASK(). Always 0 for non-blocking transmission.

NRFY_STATIC_INLINE uint32_t nrfy_uarte_rx_start(NRF_UARTE_Type *p_reg, nrfy_uarte_buffer_t const *p_xfer)

Function for starting the UARTE reception.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_xfer[in] Pointer to the structure containing reception buffer if the reception is to be blocking. NULL for non-blocking reception.

Returns:

Mask of events occured, created by NRFY_EVENT_TO_INT_BITMASK(). Always 0 for non-blocking reception.

NRFY_STATIC_INLINE void nrfy_uarte_pins_get(NRF_UARTE_Type const *p_reg, nrfy_uarte_pins_t *p_pins)

Function for getting UARTE pins configuration.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_pins[in] Pointer to the UARTE pin configurartion structure.

NRFY_STATIC_INLINE void nrfy_uarte_pins_disconnect(NRF_UARTE_Type *p_reg)

Function for disconnecting UARTE pins.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

NRFY_STATIC_INLINE void nrfy_uarte_event_clear(NRF_UARTE_Type *p_reg, nrf_uarte_event_t event)

See also

nrf_uarte_event_clear Function for clearing a specific UARTE event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event to clear.

NRFY_STATIC_INLINE bool nrfy_uarte_event_check(NRF_UARTE_Type const *p_reg, nrf_uarte_event_t event)

See also

nrf_uarte_event_check Function for retrieving the state of the UARTE event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event to be checked.

Return values:
  • true – The event has been generated.

  • false – The event has not been generated.

NRFY_STATIC_INLINE uint32_t nrfy_uarte_event_address_get(NRF_UARTE_Type const *p_reg, nrf_uarte_event_t event)

See also

nrf_uarte_event_address_get Function for returning the address of the specified UARTE event register.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] The specified event.

Returns:

Address of specified event register.

NRFY_STATIC_INLINE void nrfy_uarte_shorts_set(NRF_UARTE_Type *p_reg, uint32_t mask)

See also

nrf_uarte_shorts_set Function for configuring UARTE shortcuts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Shortcuts to be set.

NRFY_STATIC_INLINE uint32_t nrfy_uarte_shorts_get(NRF_UARTE_Type *p_reg, uint32_t mask)

See also

nrf_uarte_shorts_get Function for getting UARTE shortcuts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Shortcuts to be checked.

Returns:

Mask of requested shortcuts which were enabled.

NRFY_STATIC_INLINE void nrfy_uarte_shorts_enable(NRF_UARTE_Type *p_reg, uint32_t mask)

See also

nrf_uarte_shorts_enable Function for enabling UARTE shortcuts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Shortcuts to be enabled.

NRFY_STATIC_INLINE void nrfy_uarte_shorts_disable(NRF_UARTE_Type *p_reg, uint32_t mask)

See also

nrf_uarte_shorts_disable Function for disabling UARTE shortcuts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Shortcuts to be disabled.

NRFY_STATIC_INLINE void nrfy_uarte_int_enable(NRF_UARTE_Type *p_reg, uint32_t mask)

See also

nrf_uarte_int_enable Function for enabling UARTE interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be enabled. Use nrf_uarte_int_mask_t values for bit masking.

NRFY_STATIC_INLINE uint32_t nrfy_uarte_int_enable_check(NRF_UARTE_Type const *p_reg, uint32_t mask)

See also

nrf_uarte_int_enable_check Function for checking if the specified interrupts are enabled.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be checked. Use nrf_uarte_int_mask_t values for bit masking.

Returns:

Mask of enabled interrupts.

NRFY_STATIC_INLINE void nrfy_uarte_int_disable(NRF_UARTE_Type *p_reg, uint32_t mask)

See also

nrf_uarte_int_disable Function for disabling the specified interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be disabled. Use nrf_uarte_int_mask_t values for bit masking.

NRFY_STATIC_INLINE void nrfy_uarte_subscribe_set(NRF_UARTE_Type *p_reg, nrf_uarte_task_t task, uint8_t channel)

See also

nrf_uarte_subscribe_set Function for setting the subscribe configuration for a given UARTE task.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task for which to set the configuration.

  • channel[in] Channel through which to subscribe events.

NRFY_STATIC_INLINE void nrfy_uarte_subscribe_clear(NRF_UARTE_Type *p_reg, nrf_uarte_task_t task)

See also

nrf_uarte_subscribe_clear Function for clearing the subscribe configuration for a given UARTE task.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task for which to clear the configuration.

NRFY_STATIC_INLINE void nrfy_uarte_publish_set(NRF_UARTE_Type *p_reg, nrf_uarte_event_t event, uint8_t channel)

See also

nrf_uarte_publish_set Function for setting the publish configuration for a given UARTE event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event for which to set the configuration.

  • channel[in] Channel through which to publish the event.

NRFY_STATIC_INLINE void nrfy_uarte_publish_clear(NRF_UARTE_Type *p_reg, nrf_uarte_event_t event)

See also

nrf_uarte_publish_clear Function for clearing the publish configuration for a given UARTE event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event for which to clear the configuration.

NRFY_STATIC_INLINE uint32_t nrfy_uarte_errorsrc_get_and_clear(NRF_UARTE_Type *p_reg)

See also

nrf_uarte_errorsrc_get_and_clear Function for getting error source mask. Function is clearing error source flags after reading.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Mask with error source flags.

NRFY_STATIC_INLINE void nrfy_uarte_enable(NRF_UARTE_Type *p_reg)

See also

nrf_uarte_enable Function for enabling UARTE.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

NRFY_STATIC_INLINE void nrfy_uarte_disable(NRF_UARTE_Type *p_reg)

See also

nrf_uarte_disable Function for disabling UARTE.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

NRFY_STATIC_INLINE void nrfy_uarte_txrx_pins_set(NRF_UARTE_Type *p_reg, uint32_t pseltxd, uint32_t pselrxd)

See also

nrf_uarte_txrx_pins_set Function for configuring TX/RX pins.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • pseltxd[in] TXD pin number.

  • pselrxd[in] RXD pin number.

NRFY_STATIC_INLINE void nrfy_uarte_txrx_pins_disconnect(NRF_UARTE_Type *p_reg)

See also

nrf_uarte_txrx_pins_disconnect Function for disconnecting TX/RX pins.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

NRFY_STATIC_INLINE uint32_t nrfy_uarte_tx_pin_get(NRF_UARTE_Type const *p_reg)

See also

nrf_uarte_tx_pin_get Function for getting TX pin selection.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

TX pin selection.

NRFY_STATIC_INLINE uint32_t nrfy_uarte_rx_pin_get(NRF_UARTE_Type const *p_reg)

See also

nrf_uarte_rx_pin_get Function for getting RX pin selection.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

RX pin selection.

NRFY_STATIC_INLINE uint32_t nrfy_uarte_rts_pin_get(NRF_UARTE_Type const *p_reg)

See also

nrf_uarte_rts_pin_get Function for getting RTS pin selection.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

RTS pin selection.

NRFY_STATIC_INLINE uint32_t nrfy_uarte_cts_pin_get(NRF_UARTE_Type const *p_reg)

See also

nrf_uarte_cts_pin_get Function for getting CTS pin selection.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

CTS pin selection.

NRFY_STATIC_INLINE void nrfy_uarte_hwfc_pins_set(NRF_UARTE_Type *p_reg, uint32_t pselrts, uint32_t pselcts)

See also

nrf_uarte_hwfc_pins_set Function for configuring flow control pins.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • pselrts[in] RTS pin number.

  • pselcts[in] CTS pin number.

NRFY_STATIC_INLINE void nrfy_uarte_hwfc_pins_disconnect(NRF_UARTE_Type *p_reg)

See also

nrf_uarte_hwfc_pins_disconnect Function for disconnecting flow control pins.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

NRFY_STATIC_INLINE void nrfy_uarte_task_trigger(NRF_UARTE_Type *p_reg, nrf_uarte_task_t task)

See also

nrf_uarte_task_trigger Function for starting an UARTE task.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task.

NRFY_STATIC_INLINE uint32_t nrfy_uarte_task_address_get(NRF_UARTE_Type const *p_reg, nrf_uarte_task_t task)

See also

nrf_uarte_task_address_get Function for returning the address of the specified task register.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task.

Returns:

Task address.

NRFY_STATIC_INLINE void nrfy_uarte_configure(NRF_UARTE_Type *p_reg, nrf_uarte_config_t const *p_cfg)

See also

nrf_uarte_configure Function for configuring UARTE.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_cfg[in] Pointer to UARTE settings structure.

NRFY_STATIC_INLINE void nrfy_uarte_baudrate_set(NRF_UARTE_Type *p_reg, nrf_uarte_baudrate_t baudrate)

See also

nrf_uarte_baudrate_set Function for setting UARTE baud rate.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • baudrate[in] Baud rate.

NRFY_STATIC_INLINE void nrfy_uarte_tx_buffer_set(NRF_UARTE_Type *p_reg, uint8_t const *p_buffer, size_t length)

See also

nrf_uarte_tx_buffer_set Function for setting the transmit buffer.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_buffer[in] Pointer to the buffer with data to send.

  • length[in] Maximum number of data bytes to transmit.

NRFY_STATIC_INLINE uint8_t const *nrfy_uarte_tx_buffer_get(NRF_UARTE_Type *p_reg)

See also

nrf_uarte_tx_buffer_get Function for getting the transmit buffer address.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Pointer to the transmit buffer.

NRFY_STATIC_INLINE uint32_t nrfy_uarte_tx_amount_get(NRF_UARTE_Type const *p_reg)

See also

nrf_uarte_tx_amount_get Function for getting number of bytes transmitted in the last transaction.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Return values:

Amount – of bytes transmitted.

NRFY_STATIC_INLINE void nrfy_uarte_rx_buffer_set(NRF_UARTE_Type *p_reg, uint8_t *p_buffer, size_t length)

See also

nrf_uarte_rx_buffer_set Function for setting the receive buffer.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_buffer[in] Pointer to the buffer for received data.

  • length[in] Maximum number of data bytes to receive.

NRFY_STATIC_INLINE uint32_t nrfy_uarte_rx_amount_get(NRF_UARTE_Type const *p_reg)

See also

nrf_uarte_rx_amount_get Function for getting number of bytes received in the last transaction.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Return values:

Amount – of bytes received.

struct nrfy_uarte_pins_t
#include <nrfy_uarte.h>

UARTE pins configuration structure.

Public Members

uint32_t txd_pin

TXD pin number.

uint32_t rxd_pin

RXD pin number.

uint32_t rts_pin

RTS pin number.

uint32_t cts_pin

CTS pin number.

struct nrfy_uarte_config_t
#include <nrfy_uarte.h>

UARTE configuration structure.

Public Members

nrfy_uarte_pins_t pins

Pin configuration structure.

nrf_uarte_baudrate_t baudrate

Baud rate.

nrf_uarte_config_t config

Peripheral configuration.

bool skip_psel_cfg

Skip pin selection configuration.

When set to true, the driver does not modify pin select registers in the peripheral. Those registers are supposed to be set up externally before the driver is initialized.

Note

When both GPIO configuration and pin selection are to be skipped, the structure fields that specify pins can be omitted, as they are ignored anyway.

struct nrfy_uarte_buffer_t
#include <nrfy_uarte.h>

Structure describing an UARTE transfer.

Public Members

uint8_t *p_buffer

Buffer address.

size_t length

Data length.