synth/uart/uart.c

24 lines
353 B
C
Raw Normal View History

2021-02-17 21:20:30 +00:00
#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;
}