Go to the documentation of this file.
24 #ifndef UART_HALF_DUPLEX_H
25 #define UART_HALF_DUPLEX_H
35 #ifndef UART_HALF_DUPLEX_DEFAULT_TIMEOUT_US
36 #define UART_HALF_DUPLEX_DEFAULT_TIMEOUT_US (20000LU)
48 #define UART_HALF_DUPLEX_DIR_NONE { NULL, NULL, NULL }
@ UART_NODEV
invalid UART device given
@ UART_NOMODE
given mode is not applicable
size_t uart_half_duplex_recv(const uart_half_duplex_t *dev, size_t size)
Recv data an fill the driver's buffer.
@ UART_HALF_DUPLEX_INTERR
all other internal errors
uart_t uart
the half-duplex UART bus to use
uint32_t timeout_us
the maximum duration (in microseconds) for waiting data
@ UART_HALF_DUPLEX_NOMODE
given mode is not applicable
uart_half_duplex_params_t params
the half-duplex UART configuration
@ UART_INTERR
all other internal errors
@ UART_HALF_DUPLEX_NOBUFF
invalid buffer given
@ UART_NOBAUD
given baudrate is not applicable
unsigned int uart_t
Define default UART type identifier.
Low-level UART peripheral driver interface definition.
@ UART_HALF_DUPLEX_NODEV
invalid UART device given
half-duplex UART direction management method type
uint8_t * buffer
the buffer used for TX and RX
uart_half_duplex_dir_t dir
the direction management method
Descriptor struct for half-duplex UART.
@ UART_HALF_DUPLEX_OK
everything in order
@ UART_HALF_DUPLEX_NOBAUD
given baudrate is not applicable
size_t uart_half_duplex_send(const uart_half_duplex_t *dev, size_t size)
Send the data contained in the driver's buffer.
Configuration for half-duplex UART.
static void uart_half_duplex_set_rx(uart_half_duplex_t *dev)
Set the half-duplex UART bus in RX mode.
int uart_half_duplex_init(uart_half_duplex_t *dev, uint8_t *buffer, size_t buffer_max_size, const uart_half_duplex_params_t *params)
Initialize the half-duplex UART bus to communicate with devices.
@ UART_OK
everything in order
size_t buffer_max_size
the buffer size
static void uart_half_duplex_set_tx(uart_half_duplex_t *dev)
Set the half-duplex UART bus in TX mode.
size_t size
the number of available elements for TX/RX
uint32_t baudrate
the baudrate to use