ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
uart.h File Reference

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)
 

Detailed Description

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.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file uart.h.

Function Documentation

◆ protocore_uart_begin()

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_uart_write()

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_uart_read()

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_uart_available()

PROTOCORE_INLINE size_t protocore_uart_available ( uint8_t  unit)

Definition at line 101 of file uart.h.

◆ protocore_uart_read_byte()

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().