Currently an interrupt is triggered any time there is any activity on the UART_RXD line, but later it will only trigger once there is data ready to be read.
24 lines
430 B
C
24 lines
430 B
C
|
|
#include <stdint.h>
|
|
|
|
#include "interrupt.h"
|
|
|
|
// This is defined in main.c
|
|
void puts(const char* s);
|
|
|
|
void handle_irq() {
|
|
uint8_t status;
|
|
|
|
puts("Interrupt Detected!\n");
|
|
|
|
status = irq_get_status();
|
|
|
|
if (status & BUTTON) {
|
|
puts("Button Interrupt!\n");
|
|
irq_set_status(status & ~BUTTON);
|
|
}
|
|
if (status & UART) {
|
|
puts("UART Interrupt!\n");
|
|
irq_set_status(status & ~UART);
|
|
}
|
|
} |