#include "uart.h" int uart_rx_available() { return (*UART_STATUS & UART_STATUS_RXNE_msk) != 0; } int uart_tx_available() { return (*UART_STATUS & UART_STATUS_TXE_msk) != 0; } void uart_write(const char c) { while (!uart_tx_available()) { } *UART_DATA = c; } char uart_read() { while (!uart_rx_available()) { } return *UART_DATA; }