synth/uart/uart.h
2021-03-13 15:49:28 -08:00

17 lines
429 B
C

#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);