#pragma once #define UART_STATUS_RXNE_pos 1 #define UART_STATUS_RXNE_msk (1 << UART_STATUS_RXNE_pos) #define UART_STATUS_TXE_pos 0 #define UART_STATUS_TXE_msk (1 << UART_STATUS_TXE_pos) struct uart { volatile uint8_t data; volatile uint16_t flags; }; int uart_rx_available(struct uart* uart); int uart_tx_available(struct uart* uart); void uart_write(struct uart* uart, const char c); char uart_read(struct uart* uart); void uart_writen(struct uart* uart, const char* data, int len);