synth/uart/uart.h

17 lines
429 B
C
Raw Normal View History

2021-03-13 23:49:28 +00:00
#pragma once
2021-02-17 21:20:30 +00:00
#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)
2021-03-13 23:49:28 +00:00
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);