Add uart_rxb

Once you receive a uart interrupt you can call this function to get the
received character.
This commit is contained in:
Byron Lathi
2022-03-14 16:48:24 -05:00
parent 59d2d4f601
commit 8e161664bb
3 changed files with 15 additions and 2 deletions

View File

@@ -2,12 +2,14 @@
#include <stdint.h>
#include "interrupt.h"
#include "uart.h"
// This is defined in main.c
void puts(const char* s);
void handle_irq() {
uint8_t status;
char c;
puts("Interrupt Detected!\n");
@@ -19,6 +21,10 @@ void handle_irq() {
}
if (status & UART) {
puts("UART Interrupt!\n");
c = uart_rxb();
puts("Received: ");
puts(&c);
puts("\n");
irq_set_status(status & ~UART);
}
}