The unified diff between revisions [253c6510..] and [a39fe798..] is displayed below. It can also be downloaded as a raw diff.

#
# old_revision [253c65100e2208e0b8c93178896f5aab89e4ec0b]
# new_revision [a39fe7980c8f14b70401f4c97f3e10232dce016a]
#
# patch "event.h"
#  from [b92070564927535f836fe3cfc7b9460703f7afa0]
#    to [6ae28929ff160f4c112bac5954c1fbfa282b6756]
# 
# patch "main.c"
#  from [d5ad069a51eff072171a593f4f480b1e8aab11bb]
#    to [38594d91649f88377c87a52973d831d9ffeafb70]
# 
# patch "uart.c"
#  from [601012b857324c934c9bc318a55df1029187a16b]
#    to [7c57b3658cbce3a90ff7773d9e4a0b1d626c68af]
#
============================================================
--- event.h	b92070564927535f836fe3cfc7b9460703f7afa0
+++ event.h	6ae28929ff160f4c112bac5954c1fbfa282b6756
@@ -5,8 +5,9 @@
 
 #define EVENT_TIMER		0
 #define EVENT_I2C_COMPLETE	1
+#define EVENT_UART_INPUT	2
 
-#define EVENT_MAX		1
+#define EVENT_MAX		2
 
 typedef void event_handler(void);
 
============================================================
--- main.c	d5ad069a51eff072171a593f4f480b1e8aab11bb
+++ main.c	38594d91649f88377c87a52973d831d9ffeafb70
@@ -159,21 +159,35 @@ void average_sample(void)
 	putstr(")\r\n");
 }
 
-int main(void) {
-	int i;
+void menu_handler(void);
 
+int main(void) {
 	init_interrupt();
 	init_uart();
 	init_i2c();
 	init_pins();
 	init_timer();
+
+	event_register(EVENT_UART_INPUT, menu_handler);
+
 	putstr("Your entire life has been a mathematical error... a mathematical error I'm about to correct!\r\n");
 
+	putstr("prompt> ");
+
 	while (1) {
-		char c;
-		putstr("prompt> ");
-		while (!getch(&c))
-			FP0XVAL ^= 0x04000000;
+		FP0XVAL ^= 0x04000000;
+		event_dispatch();
+	}
+
+	return 0;
+}
+
+void menu_handler(void)
+{
+	int i;
+	char c;
+
+	while (getch(&c)) {
 		if (c == 0x0a)
 			continue;
 		putch(c);
@@ -265,7 +279,6 @@ int main(void) {
 			reply("Unrecognised command.");
 			break;
 		}
+		putstr("prompt> ");
 	}
-
-	return 0;
 }
============================================================
--- uart.c	601012b857324c934c9bc318a55df1029187a16b
+++ uart.c	7c57b3658cbce3a90ff7773d9e4a0b1d626c68af
@@ -1,6 +1,7 @@
 #include "uart.h"
 #include "types.h"
 #include "interrupt.h"
+#include "event.h"
 
 #define UARTBASE 0xE000C000
 
@@ -112,6 +113,7 @@ void __attribute__((interrupt("IRQ"))) u
 			}
 		}
 		uart_rxwrite = local_rxwrite;
+		event_set(EVENT_UART_INPUT);
 		break;
 
 	case 0x2: /* THRE interrupt */