Initial commit

This commit is contained in:
Paul Mathieu
2021-02-17 13:20:30 -08:00
commit 363944d417
35 changed files with 3318 additions and 0 deletions

23
uart/uart.c Normal file
View File

@@ -0,0 +1,23 @@
#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;
}