UARTE HAL
- group nrf_uarte_hal
Hardware access layer for managing the UARTE peripheral.
Defines
-
NRF_UARTE_INST_GET(idx)
Macro getting pointer to the structure of registers of the UARTE peripheral.
- Parameters:
idx – [in] UARTE instance index.
- Returns:
Pointer to the structure of registers of the UARTE peripheral.
-
NRF_UARTE_HAS_DMA_REG
Symbol indicating whether dedicated DMA register is present.
-
NRF_UARTE_HAS_DMA_TASKS_EVENTS
Symbol indicating whether UARTE DMA tasks and events are present.
Enums
-
enum nrf_uarte_task_t
UARTE tasks.
Values:
-
enumerator NRF_UARTE_TASK_STARTRX
Start UART receiver.
-
enumerator NRF_UARTE_TASK_STOPRX
Stop UART receiver.
-
enumerator NRF_UARTE_TASK_STARTTX
Start UART transmitter.
-
enumerator NRF_UARTE_TASK_STOPTX
Stop UART transmitter.
-
enumerator NRF_UARTE_TASK_FLUSHRX
Flush RX FIFO in RX buffer.
-
enumerator NRF_UARTE_TASK_STARTRX
-
enum nrf_uarte_event_t
UARTE events.
Values:
-
enumerator NRF_UARTE_EVENT_CTS
CTS is activated.
-
enumerator NRF_UARTE_EVENT_NCTS
CTS is deactivated.
-
enumerator NRF_UARTE_EVENT_RXDRDY
Data received in RXD (but potentially not yet transferred to Data RAM).
-
enumerator NRF_UARTE_EVENT_TXDRDY
Data sent from TXD.
-
enumerator NRF_UARTE_EVENT_ERROR
Error detected.
-
enumerator NRF_UARTE_EVENT_RXTO
Receiver timeout.
-
enumerator NRF_UARTE_EVENT_TXSTOPPED
Transmitted stopped.
-
enumerator NRF_UARTE_EVENT_ENDRX
Receive buffer is filled up.
-
enumerator NRF_UARTE_EVENT_ENDTX
Last TX byte transmitted.
-
enumerator NRF_UARTE_EVENT_RXSTARTED
Receiver has started.
-
enumerator NRF_UARTE_EVENT_TXSTARTED
Transmitter has started.
-
enumerator NRF_UARTE_EVENT_CTS
-
enum nrf_uarte_short_t
Types of UARTE shortcuts.
Values:
-
enumerator NRF_UARTE_SHORT_ENDRX_STARTRX
Shortcut between ENDRX event and STARTRX task.
-
enumerator NRF_UARTE_SHORT_ENDRX_STOPRX
Shortcut between ENDRX event and STOPRX task.
-
enumerator NRF_UARTE_SHORT_ENDRX_STARTRX
-
enum nrf_uarte_int_mask_t
UARTE interrupts.
Values:
-
enumerator NRF_UARTE_INT_CTS_MASK
Interrupt on CTS event.
-
enumerator NRF_UARTE_INT_NCTS_MASK
Interrupt on NCTS event.
-
enumerator NRF_UARTE_INT_RXDRDY_MASK
Interrupt on RXDRDY event.
-
enumerator NRF_UARTE_INT_TXDRDY_MASK
Interrupt on TXDRDY event.
-
enumerator NRF_UARTE_INT_ERROR_MASK
Interrupt on ERROR event.
-
enumerator NRF_UARTE_INT_RXTO_MASK
Interrupt on RXTO event.
-
enumerator NRF_UARTE_INT_TXSTOPPED_MASK
Interrupt on TXSTOPPED event.
-
enumerator NRF_UARTE_INT_ENDRX_MASK
Interrupt on ENDRX event.
-
enumerator NRF_UARTE_INT_ENDTX_MASK
Interrupt on ENDTX event.
-
enumerator NRF_UARTE_INT_RXSTARTED_MASK
Interrupt on RXSTARTED event.
-
enumerator NRF_UARTE_INT_TXSTARTED_MASK
Interrupt on TXSTARTED event.
-
enumerator NRF_UARTE_INT_CTS_MASK
-
enum nrf_uarte_baudrate_t
Baudrates supported by UARTE.
Values:
-
enumerator NRF_UARTE_BAUDRATE_1200
1200 baud.
-
enumerator NRF_UARTE_BAUDRATE_2400
2400 baud.
-
enumerator NRF_UARTE_BAUDRATE_4800
4800 baud.
-
enumerator NRF_UARTE_BAUDRATE_9600
9600 baud.
-
enumerator NRF_UARTE_BAUDRATE_14400
14400 baud.
-
enumerator NRF_UARTE_BAUDRATE_19200
19200 baud.
-
enumerator NRF_UARTE_BAUDRATE_28800
28800 baud.
-
enumerator NRF_UARTE_BAUDRATE_31250
31250 baud.
-
enumerator NRF_UARTE_BAUDRATE_38400
38400 baud.
-
enumerator NRF_UARTE_BAUDRATE_56000
56000 baud.
-
enumerator NRF_UARTE_BAUDRATE_57600
57600 baud.
-
enumerator NRF_UARTE_BAUDRATE_76800
76800 baud.
-
enumerator NRF_UARTE_BAUDRATE_115200
115200 baud.
-
enumerator NRF_UARTE_BAUDRATE_230400
230400 baud.
-
enumerator NRF_UARTE_BAUDRATE_250000
250000 baud.
-
enumerator NRF_UARTE_BAUDRATE_460800
460800 baud.
-
enumerator NRF_UARTE_BAUDRATE_921600
921600 baud.
-
enumerator NRF_UARTE_BAUDRATE_1000000
1000000 baud.
-
enumerator NRF_UARTE_BAUDRATE_1200
-
enum nrf_uarte_error_mask_t
Types of UARTE error masks.
Values:
-
enumerator NRF_UARTE_ERROR_OVERRUN_MASK
Overrun error.
-
enumerator NRF_UARTE_ERROR_PARITY_MASK
Parity error.
-
enumerator NRF_UARTE_ERROR_FRAMING_MASK
Framing error.
-
enumerator NRF_UARTE_ERROR_BREAK_MASK
Break error.
-
enumerator NRF_UARTE_ERROR_OVERRUN_MASK
-
enum nrf_uarte_parity_t
Types of UARTE parity modes.
Values:
-
enumerator NRF_UARTE_PARITY_EXCLUDED
Parity excluded.
-
enumerator NRF_UARTE_PARITY_INCLUDED
Parity included.
-
enumerator NRF_UARTE_PARITY_EXCLUDED
-
enum nrf_uarte_hwfc_t
Types of UARTE flow control modes.
Values:
-
enumerator NRF_UARTE_HWFC_DISABLED
Hardware flow control disabled.
-
enumerator NRF_UARTE_HWFC_ENABLED
Hardware flow control enabled.
-
enumerator NRF_UARTE_HWFC_DISABLED
Functions
-
NRF_STATIC_INLINE void nrf_uarte_event_clear(NRF_UARTE_Type *p_reg, nrf_uarte_event_t event)
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.
-
NRF_STATIC_INLINE bool nrf_uarte_event_check(NRF_UARTE_Type const *p_reg, nrf_uarte_event_t event)
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.
-
NRF_STATIC_INLINE uint32_t nrf_uarte_event_address_get(NRF_UARTE_Type const *p_reg, nrf_uarte_event_t event)
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.
-
NRF_STATIC_INLINE void nrf_uarte_shorts_enable(NRF_UARTE_Type *p_reg, uint32_t mask)
Function for enabling UARTE shortcuts.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
mask – [in] Shortcuts to be enabled.
-
NRF_STATIC_INLINE void nrf_uarte_shorts_disable(NRF_UARTE_Type *p_reg, uint32_t mask)
Function for disabling UARTE shortcuts.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
mask – [in] Shortcuts to be disabled.
-
NRF_STATIC_INLINE void nrf_uarte_int_enable(NRF_UARTE_Type *p_reg, uint32_t mask)
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.
-
NRF_STATIC_INLINE uint32_t nrf_uarte_int_enable_check(NRF_UARTE_Type const *p_reg, uint32_t mask)
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.
- Returns:
Mask of enabled interrupts.
-
NRF_STATIC_INLINE void nrf_uarte_int_disable(NRF_UARTE_Type *p_reg, uint32_t mask)
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.
-
NRF_STATIC_INLINE void nrf_uarte_subscribe_set(NRF_UARTE_Type *p_reg, nrf_uarte_task_t task, uint8_t channel)
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.
-
NRF_STATIC_INLINE void nrf_uarte_subscribe_clear(NRF_UARTE_Type *p_reg, nrf_uarte_task_t task)
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.
-
NRF_STATIC_INLINE void nrf_uarte_publish_set(NRF_UARTE_Type *p_reg, nrf_uarte_event_t event, uint8_t channel)
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.
-
NRF_STATIC_INLINE void nrf_uarte_publish_clear(NRF_UARTE_Type *p_reg, nrf_uarte_event_t event)
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.
-
NRF_STATIC_INLINE uint32_t nrf_uarte_errorsrc_get_and_clear(NRF_UARTE_Type *p_reg)
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.
-
NRF_STATIC_INLINE void nrf_uarte_enable(NRF_UARTE_Type *p_reg)
Function for enabling UARTE.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
-
NRF_STATIC_INLINE void nrf_uarte_disable(NRF_UARTE_Type *p_reg)
Function for disabling UARTE.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
-
NRF_STATIC_INLINE void nrf_uarte_txrx_pins_set(NRF_UARTE_Type *p_reg, uint32_t pseltxd, uint32_t pselrxd)
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.
-
NRF_STATIC_INLINE void nrf_uarte_txrx_pins_disconnect(NRF_UARTE_Type *p_reg)
Function for disconnecting TX/RX pins.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
-
NRF_STATIC_INLINE uint32_t nrf_uarte_tx_pin_get(NRF_UARTE_Type const *p_reg)
Function for getting TX pin selection.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns:
TX pin selection.
-
NRF_STATIC_INLINE uint32_t nrf_uarte_rx_pin_get(NRF_UARTE_Type const *p_reg)
Function for getting RX pin selection.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns:
RX pin selection.
-
NRF_STATIC_INLINE uint32_t nrf_uarte_rts_pin_get(NRF_UARTE_Type const *p_reg)
Function for getting RTS pin selection.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns:
RTS pin selection.
-
NRF_STATIC_INLINE uint32_t nrf_uarte_cts_pin_get(NRF_UARTE_Type const *p_reg)
Function for getting CTS pin selection.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns:
CTS pin selection.
-
NRF_STATIC_INLINE void nrf_uarte_hwfc_pins_set(NRF_UARTE_Type *p_reg, uint32_t pselrts, uint32_t pselcts)
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.
-
NRF_STATIC_INLINE void nrf_uarte_hwfc_pins_disconnect(NRF_UARTE_Type *p_reg)
Function for disconnecting flow control pins.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
-
NRF_STATIC_INLINE void nrf_uarte_task_trigger(NRF_UARTE_Type *p_reg, nrf_uarte_task_t task)
Function for starting an UARTE task.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
task – [in] Task.
-
NRF_STATIC_INLINE uint32_t nrf_uarte_task_address_get(NRF_UARTE_Type const *p_reg, nrf_uarte_task_t task)
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.
-
NRF_STATIC_INLINE void nrf_uarte_configure(NRF_UARTE_Type *p_reg, nrf_uarte_config_t const *p_cfg)
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.
-
NRF_STATIC_INLINE void nrf_uarte_baudrate_set(NRF_UARTE_Type *p_reg, nrf_uarte_baudrate_t baudrate)
Function for setting UARTE baud rate.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
baudrate – [in] Baud rate.
-
NRF_STATIC_INLINE void nrf_uarte_tx_buffer_set(NRF_UARTE_Type *p_reg, uint8_t const *p_buffer, size_t length)
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.
-
NRF_STATIC_INLINE uint32_t nrf_uarte_tx_amount_get(NRF_UARTE_Type const *p_reg)
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.
-
NRF_STATIC_INLINE void nrf_uarte_rx_buffer_set(NRF_UARTE_Type *p_reg, uint8_t *p_buffer, size_t length)
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.
-
NRF_STATIC_INLINE uint32_t nrf_uarte_rx_amount_get(NRF_UARTE_Type const *p_reg)
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 nrf_uarte_config_t
- #include <nrf_uarte.h>
Structure for UARTE transmission configuration.
Public Members
-
nrf_uarte_hwfc_t hwfc
Flow control configuration.
-
nrf_uarte_parity_t parity
Parity configuration.
-
nrf_uarte_stop_t stop
Stop bits.
-
nrf_uarte_paritytype_t paritytype
Parity type.
-
nrf_uarte_hwfc_t hwfc
-
NRF_UARTE_INST_GET(idx)