Hardware access layer for accessing the UART peripheral. More...
Macros | |
#define | NRF_UART_PSEL_DISCONNECTED 0xFFFFFFFF |
Enumerations | |
enum | nrf_uart_task_t { NRF_UART_TASK_STARTRX = offsetof(NRF_UART_Type, TASKS_STARTRX), NRF_UART_TASK_STOPRX = offsetof(NRF_UART_Type, TASKS_STOPRX), NRF_UART_TASK_STARTTX = offsetof(NRF_UART_Type, TASKS_STARTTX), NRF_UART_TASK_STOPTX = offsetof(NRF_UART_Type, TASKS_STOPTX), NRF_UART_TASK_SUSPEND = offsetof(NRF_UART_Type, TASKS_SUSPEND) } |
UART tasks. More... | |
enum | nrf_uart_event_t { NRF_UART_EVENT_CTS = offsetof(NRF_UART_Type, EVENTS_CTS), NRF_UART_EVENT_NCTS = offsetof(NRF_UART_Type, EVENTS_NCTS), NRF_UART_EVENT_RXDRDY = offsetof(NRF_UART_Type, EVENTS_RXDRDY), NRF_UART_EVENT_TXDRDY = offsetof(NRF_UART_Type, EVENTS_TXDRDY), NRF_UART_EVENT_ERROR = offsetof(NRF_UART_Type, EVENTS_ERROR), NRF_UART_EVENT_RXTO = offsetof(NRF_UART_Type, EVENTS_RXTO) } |
UART events. More... | |
enum | nrf_uart_int_mask_t { NRF_UART_INT_MASK_CTS = UART_INTENCLR_CTS_Msk, NRF_UART_INT_MASK_NCTS = UART_INTENCLR_NCTS_Msk, NRF_UART_INT_MASK_RXDRDY = UART_INTENCLR_RXDRDY_Msk, NRF_UART_INT_MASK_TXDRDY = UART_INTENCLR_TXDRDY_Msk, NRF_UART_INT_MASK_ERROR = UART_INTENCLR_ERROR_Msk, NRF_UART_INT_MASK_RXTO = UART_INTENCLR_RXTO_Msk } |
UART interrupts. More... | |
enum | nrf_uart_baudrate_t { NRF_UART_BAUDRATE_1200 = UART_BAUDRATE_BAUDRATE_Baud1200, NRF_UART_BAUDRATE_2400 = UART_BAUDRATE_BAUDRATE_Baud2400, NRF_UART_BAUDRATE_4800 = UART_BAUDRATE_BAUDRATE_Baud4800, NRF_UART_BAUDRATE_9600 = UART_BAUDRATE_BAUDRATE_Baud9600, NRF_UART_BAUDRATE_14400 = UART_BAUDRATE_BAUDRATE_Baud14400, NRF_UART_BAUDRATE_19200 = UART_BAUDRATE_BAUDRATE_Baud19200, NRF_UART_BAUDRATE_28800 = UART_BAUDRATE_BAUDRATE_Baud28800, NRF_UART_BAUDRATE_38400 = UART_BAUDRATE_BAUDRATE_Baud38400, NRF_UART_BAUDRATE_57600 = UART_BAUDRATE_BAUDRATE_Baud57600, NRF_UART_BAUDRATE_76800 = UART_BAUDRATE_BAUDRATE_Baud76800, NRF_UART_BAUDRATE_115200 = UART_BAUDRATE_BAUDRATE_Baud115200, NRF_UART_BAUDRATE_230400 = UART_BAUDRATE_BAUDRATE_Baud230400, NRF_UART_BAUDRATE_250000 = UART_BAUDRATE_BAUDRATE_Baud250000, NRF_UART_BAUDRATE_460800 = UART_BAUDRATE_BAUDRATE_Baud460800, NRF_UART_BAUDRATE_921600 = UART_BAUDRATE_BAUDRATE_Baud921600, NRF_UART_BAUDRATE_1000000 = UART_BAUDRATE_BAUDRATE_Baud1M } |
Baudrates supported by UART. More... | |
enum | nrf_uart_error_mask_t { NRF_UART_ERROR_OVERRUN_MASK = UART_ERRORSRC_OVERRUN_Msk, NRF_UART_ERROR_PARITY_MASK = UART_ERRORSRC_PARITY_Msk, NRF_UART_ERROR_FRAMING_MASK = UART_ERRORSRC_FRAMING_Msk, NRF_UART_ERROR_BREAK_MASK = UART_ERRORSRC_BREAK_Msk } |
Types of UART error masks. More... | |
enum | nrf_uart_parity_t { NRF_UART_PARITY_EXCLUDED = UART_CONFIG_PARITY_Excluded << UART_CONFIG_PARITY_Pos, NRF_UART_PARITY_INCLUDED = UART_CONFIG_PARITY_Included << UART_CONFIG_PARITY_Pos } |
Types of UART parity modes. More... | |
enum | nrf_uart_hwfc_t { NRF_UART_HWFC_DISABLED = UART_CONFIG_HWFC_Disabled, NRF_UART_HWFC_ENABLED = UART_CONFIG_HWFC_Enabled } |
Types of UART flow control modes. More... | |
Functions | |
__STATIC_INLINE void | nrf_uart_event_clear (NRF_UART_Type *p_reg, nrf_uart_event_t event) |
Function for clearing a specific UART event. More... | |
__STATIC_INLINE bool | nrf_uart_event_check (NRF_UART_Type *p_reg, nrf_uart_event_t event) |
Function for checking the state of a specific UART event. More... | |
__STATIC_INLINE uint32_t | nrf_uart_event_address_get (NRF_UART_Type *p_reg, nrf_uart_event_t event) |
Function for returning the address of a specific UART event register. More... | |
__STATIC_INLINE void | nrf_uart_int_enable (NRF_UART_Type *p_reg, uint32_t int_mask) |
Function for enabling a specific interrupt. More... | |
__STATIC_INLINE bool | nrf_uart_int_enable_check (NRF_UART_Type *p_reg, uint32_t int_mask) |
Function for retrieving the state of a given interrupt. More... | |
__STATIC_INLINE void | nrf_uart_int_disable (NRF_UART_Type *p_reg, uint32_t int_mask) |
Function for disabling specific interrupts. More... | |
__STATIC_INLINE uint32_t | nrf_uart_errorsrc_get_and_clear (NRF_UART_Type *p_reg) |
Function for getting error source mask. Function is clearing error source flags after reading. More... | |
__STATIC_INLINE void | nrf_uart_enable (NRF_UART_Type *p_reg) |
Function for enabling UART. More... | |
__STATIC_INLINE void | nrf_uart_disable (NRF_UART_Type *p_reg) |
Function for disabling UART. More... | |
__STATIC_INLINE void | nrf_uart_txrx_pins_set (NRF_UART_Type *p_reg, uint32_t pseltxd, uint32_t pselrxd) |
Function for configuring TX/RX pins. More... | |
__STATIC_INLINE void | nrf_uart_txrx_pins_disconnect (NRF_UART_Type *p_reg) |
Function for disconnecting TX/RX pins. More... | |
__STATIC_INLINE uint32_t | nrf_uart_tx_pin_get (NRF_UART_Type *p_reg) |
Function for getting TX pin. More... | |
__STATIC_INLINE uint32_t | nrf_uart_rx_pin_get (NRF_UART_Type *p_reg) |
Function for getting RX pin. More... | |
__STATIC_INLINE uint32_t | nrf_uart_rts_pin_get (NRF_UART_Type *p_reg) |
Function for getting RTS pin. More... | |
__STATIC_INLINE uint32_t | nrf_uart_cts_pin_get (NRF_UART_Type *p_reg) |
Function for getting CTS pin. More... | |
__STATIC_INLINE void | nrf_uart_hwfc_pins_set (NRF_UART_Type *p_reg, uint32_t pselrts, uint32_t pselcts) |
Function for configuring flow control pins. More... | |
__STATIC_INLINE void | nrf_uart_hwfc_pins_disconnect (NRF_UART_Type *p_reg) |
Function for disconnecting flow control pins. More... | |
__STATIC_INLINE uint8_t | nrf_uart_rxd_get (NRF_UART_Type *p_reg) |
Function for reading RX data. More... | |
__STATIC_INLINE void | nrf_uart_txd_set (NRF_UART_Type *p_reg, uint8_t txd) |
Function for setting Tx data. More... | |
__STATIC_INLINE void | nrf_uart_task_trigger (NRF_UART_Type *p_reg, nrf_uart_task_t task) |
Function for starting an UART task. More... | |
__STATIC_INLINE uint32_t | nrf_uart_task_address_get (NRF_UART_Type *p_reg, nrf_uart_task_t task) |
Function for returning the address of a specific task register. More... | |
__STATIC_INLINE void | nrf_uart_configure (NRF_UART_Type *p_reg, nrf_uart_parity_t parity, nrf_uart_hwfc_t hwfc) |
Function for configuring UART. More... | |
__STATIC_INLINE void | nrf_uart_baudrate_set (NRF_UART_Type *p_reg, nrf_uart_baudrate_t baudrate) |
Function for setting UART baudrate. More... | |
Hardware access layer for accessing the UART peripheral.
enum nrf_uart_baudrate_t |
Baudrates supported by UART.
enum nrf_uart_event_t |
UART events.
enum nrf_uart_hwfc_t |
enum nrf_uart_int_mask_t |
UART interrupts.
enum nrf_uart_parity_t |
enum nrf_uart_task_t |
__STATIC_INLINE void nrf_uart_baudrate_set | ( | NRF_UART_Type * | p_reg, |
nrf_uart_baudrate_t | baudrate | ||
) |
Function for setting UART baudrate.
p_reg | Pointer to the peripheral registers structure. |
baudrate | Baudrate. |
__STATIC_INLINE void nrf_uart_configure | ( | NRF_UART_Type * | p_reg, |
nrf_uart_parity_t | parity, | ||
nrf_uart_hwfc_t | hwfc | ||
) |
Function for configuring UART.
p_reg | Pointer to the peripheral registers structure. |
hwfc | Hardware flow control. Enabled if true. |
parity | Parity. Included if true. |
__STATIC_INLINE uint32_t nrf_uart_cts_pin_get | ( | NRF_UART_Type * | p_reg | ) |
Function for getting CTS pin.
p_reg | Pointer to the peripheral registers structure. |
__STATIC_INLINE void nrf_uart_disable | ( | NRF_UART_Type * | p_reg | ) |
Function for disabling UART.
p_reg | Pointer to the peripheral registers structure. |
__STATIC_INLINE void nrf_uart_enable | ( | NRF_UART_Type * | p_reg | ) |
Function for enabling UART.
p_reg | Pointer to the peripheral registers structure. |
__STATIC_INLINE uint32_t nrf_uart_errorsrc_get_and_clear | ( | NRF_UART_Type * | p_reg | ) |
Function for getting error source mask. Function is clearing error source flags after reading.
p_reg | Pointer to the peripheral registers structure. |
__STATIC_INLINE uint32_t nrf_uart_event_address_get | ( | NRF_UART_Type * | p_reg, |
nrf_uart_event_t | event | ||
) |
Function for returning the address of a specific UART event register.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | event | Desired event. |
Address | of specified event register. |
__STATIC_INLINE bool nrf_uart_event_check | ( | NRF_UART_Type * | p_reg, |
nrf_uart_event_t | event | ||
) |
Function for checking the state of a specific UART event.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | event | Event to check. |
True | if event is set, False otherwise. |
__STATIC_INLINE void nrf_uart_event_clear | ( | NRF_UART_Type * | p_reg, |
nrf_uart_event_t | event | ||
) |
Function for clearing a specific UART event.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | event | Event to clear. |
__STATIC_INLINE void nrf_uart_hwfc_pins_disconnect | ( | NRF_UART_Type * | p_reg | ) |
Function for disconnecting flow control pins.
p_reg | Pointer to the peripheral registers structure. |
__STATIC_INLINE void nrf_uart_hwfc_pins_set | ( | NRF_UART_Type * | p_reg, |
uint32_t | pselrts, | ||
uint32_t | pselcts | ||
) |
Function for configuring flow control pins.
p_reg | Pointer to the peripheral registers structure. |
pselrts | RTS pin number. |
pselcts | CTS pin number. |
__STATIC_INLINE void nrf_uart_int_disable | ( | NRF_UART_Type * | p_reg, |
uint32_t | int_mask | ||
) |
Function for disabling specific interrupts.
p_reg | Pointer to the peripheral registers structure. |
int_mask | Interrupts to disable. |
__STATIC_INLINE void nrf_uart_int_enable | ( | NRF_UART_Type * | p_reg, |
uint32_t | int_mask | ||
) |
Function for enabling a specific interrupt.
p_reg | Pointer to the peripheral registers structure. |
int_mask | Interrupts to enable. |
__STATIC_INLINE bool nrf_uart_int_enable_check | ( | NRF_UART_Type * | p_reg, |
uint32_t | int_mask | ||
) |
Function for retrieving the state of a given interrupt.
p_reg | Pointer to the peripheral registers structure. |
int_mask | Mask of interrupt to check. |
true | If the interrupt is enabled. |
false | If the interrupt is not enabled. |
__STATIC_INLINE uint32_t nrf_uart_rts_pin_get | ( | NRF_UART_Type * | p_reg | ) |
Function for getting RTS pin.
p_reg | Pointer to the peripheral registers structure. |
__STATIC_INLINE uint32_t nrf_uart_rx_pin_get | ( | NRF_UART_Type * | p_reg | ) |
Function for getting RX pin.
p_reg | Pointer to the peripheral registers structure. |
__STATIC_INLINE uint8_t nrf_uart_rxd_get | ( | NRF_UART_Type * | p_reg | ) |
Function for reading RX data.
p_reg | Pointer to the peripheral registers structure. |
__STATIC_INLINE uint32_t nrf_uart_task_address_get | ( | NRF_UART_Type * | p_reg, |
nrf_uart_task_t | task | ||
) |
Function for returning the address of a specific task register.
p_reg | Pointer to the peripheral registers structure. |
task | Task. |
__STATIC_INLINE void nrf_uart_task_trigger | ( | NRF_UART_Type * | p_reg, |
nrf_uart_task_t | task | ||
) |
Function for starting an UART task.
p_reg | Pointer to the peripheral registers structure. |
task | Task. |
__STATIC_INLINE uint32_t nrf_uart_tx_pin_get | ( | NRF_UART_Type * | p_reg | ) |
Function for getting TX pin.
p_reg | Pointer to the peripheral registers structure. |
__STATIC_INLINE void nrf_uart_txd_set | ( | NRF_UART_Type * | p_reg, |
uint8_t | txd | ||
) |
Function for setting Tx data.
p_reg | Pointer to the peripheral registers structure. |
txd | Byte. |
__STATIC_INLINE void nrf_uart_txrx_pins_disconnect | ( | NRF_UART_Type * | p_reg | ) |
Function for disconnecting TX/RX pins.
p_reg | Pointer to the peripheral registers structure. |
__STATIC_INLINE void nrf_uart_txrx_pins_set | ( | NRF_UART_Type * | p_reg, |
uint32_t | pseltxd, | ||
uint32_t | pselrxd | ||
) |
Function for configuring TX/RX pins.
p_reg | Pointer to the peripheral registers structure. |
pseltxd | TXD pin number. |
pselrxd | RXD pin number. |