|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
The one owner of the UART units for the peripheral drivers. More...
Go to the source code of this file.
Functions | |
| PROTOCORE_INLINE proto_bool | protocore_uart_begin (uint8_t unit, uint32_t baud, int rx_pin, int tx_pin) |
| PROTOCORE_INLINE proto_bool | protocore_uart_write (uint8_t unit, const uint8_t *buf, size_t len) |
| PROTOCORE_INLINE size_t | protocore_uart_read (uint8_t unit, uint8_t *buf, size_t len, uint32_t ms) |
| PROTOCORE_INLINE size_t | protocore_uart_available (uint8_t unit) |
| PROTOCORE_INLINE proto_bool | protocore_uart_read_byte (uint8_t unit, uint8_t *out) |
The one owner of the UART units for the peripheral drivers.
The third sibling of i2c.h and spi.h, for the parts that speak a serial stream rather than a bus: the mmWave presence radars (LD2410, HMMD) and the interface bridge's UART targets. A unit is a controller index, 0 upward; which pins it runs on is a board fact, so the caller names them and -1 leaves a pin at the unit's default.
A driver reads what has arrived rather than blocking on a byte count: protocore_uart_available reports the depth of the driver's receive ring, and protocore_uart_read takes what is there up to its timeout. Nothing here waits without a bound (SRC_LAW rule 5).
The bodies compile wherever the platform states a bus.
Definition in file uart.h.
| PROTOCORE_INLINE proto_bool protocore_uart_begin | ( | uint8_t | unit, |
| uint32_t | baud, | ||
| int | rx_pin, | ||
| int | tx_pin | ||
| ) |
Definition at line 75 of file uart.h.
References PROTO_TRUE.
| PROTOCORE_INLINE proto_bool protocore_uart_write | ( | uint8_t | unit, |
| const uint8_t * | buf, | ||
| size_t | len | ||
| ) |
Definition at line 84 of file uart.h.
References PROTO_FALSE.
| PROTOCORE_INLINE size_t protocore_uart_read | ( | uint8_t | unit, |
| uint8_t * | buf, | ||
| size_t | len, | ||
| uint32_t | ms | ||
| ) |
Definition at line 92 of file uart.h.
Referenced by protocore_uart_read_byte().
| PROTOCORE_INLINE size_t protocore_uart_available | ( | uint8_t | unit | ) |
| PROTOCORE_INLINE proto_bool protocore_uart_read_byte | ( | uint8_t | unit, |
| uint8_t * | out | ||
| ) |
Definition at line 107 of file uart.h.
References protocore_uart_read().