Initial commit
This commit is contained in:
23
uart/uart.c
Normal file
23
uart/uart.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user