UART driver for the nRF5 UARTE peripheral.
More...
UART driver for the nRF5 UARTE peripheral.
Bytes are sent one at a time through EasyDMA. Reception runs through EasyDMA into the two halves of a receive buffer, while a TIMER of its own in counter mode counts the received bytes through a PPI channel. Odd parity and flow control are not supported.
TX is an output, idle high. RX is an input with its wiring flags, e.g. a pull, connected when reception first starts. An instance connects its interrupt itself, with priority CONFIG_UART_NRF5_IRQ_PRIO:
#define PBL_GPIO(_port, _pin, _flags)
Initializer for a struct pbl_gpio.
Definition gpio.h:158
#define PBL_UART_NRF5_DEFINE(sym, _name, _base, _irq, _baudrate, _tx, _rx, _timer)
Define a serial port on an nRF5 UARTE instance.
Definition nrf5.h:78
◆ pbl_uart_nrf5
| Data Fields |
|
uintptr_t |
base |
Registers. |
|
pbl_irq_t |
irq |
Interrupt line. |
|
struct pbl_gpio |
rx |
RX pin. |
|
struct pbl_uart_nrf5_state * |
state |
Driver runtime state. |
|
uintptr_t |
timer |
Registers of the TIMER counting received bytes. |
|
struct pbl_gpio |
tx |
TX pin. |
|
struct pbl_uart |
uart |
Serial port. |
◆ PBL_UART_NRF5_DEFINE
| #define PBL_UART_NRF5_DEFINE |
( |
|
sym, |
|
|
|
_name, |
|
|
|
_base, |
|
|
|
_irq, |
|
|
|
_baudrate, |
|
|
|
_tx, |
|
|
|
_rx, |
|
|
|
_timer |
|
) |
| |
Value:
static struct pbl_uart_nrf5_state sym##_nrf5_state; \
.uart =
PBL_UART_INIT(sym, _name,
nullptr, &pbl_uart_nrf5_ops, _baudrate), \
.state = &sym##_nrf5_state, \
.base = (_base), \
.irq = (_irq), \
.tx = _tx, \
.rx = _rx, \
.timer = (_timer), \
}; \
nRF5 serial port.
Definition nrf5.h:45
void pbl_uart_nrf5_irq_handler(const struct pbl_uart_nrf5 *uart)
UARTE interrupt handler, connected by PBL_UART_NRF5_DEFINE().
A serial port.
Definition uart.h:135
#define PBL_UART_STATE_DEFINE(sym)
Define the class state of port sym, for the PBL_UART_*_DEFINE() macro of a driver.
Definition uart.h:151
#define PBL_UART_INIT(sym, _name, _parent, _ops, _baudrate)
Initializer for the struct pbl_uart of port sym.
Definition uart.h:164
Define a serial port on an nRF5 UARTE instance.
- Parameters
-
| sym | Symbol of the port. |
| _name | Name. |
| _base | Registers. |
| _irq | Interrupt line. |
| _baudrate | Initial baud rate, in bits per second. |
| _tx | TX pin, from PBL_GPIO(). |
| _rx | RX pin, from PBL_GPIO(). |
| _timer | Registers of the TIMER counting received bytes. |
◆ PBL_UART_NRF5_RX_BUF_SIZE
| #define PBL_UART_NRF5_RX_BUF_SIZE 256U |
Size of the receive buffer, in bytes.
◆ pbl_uart_nrf5_irq_handler()
| void pbl_uart_nrf5_irq_handler |
( |
const struct pbl_uart_nrf5 * |
uart | ) |
|