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

This diff has been restricted to the following files: 'main.c'

#
# old_revision [a39fe7980c8f14b70401f4c97f3e10232dce016a]
# new_revision [23a3e9a50b4034343e3bd217d2c225dcaec064dd]
#
# patch "main.c"
#  from [38594d91649f88377c87a52973d831d9ffeafb70]
#    to [e1a823b4962f3e8dc43b519a1f57745854ae6689]
#
============================================================
--- main.c	38594d91649f88377c87a52973d831d9ffeafb70
+++ main.c	e1a823b4962f3e8dc43b519a1f57745854ae6689
@@ -159,6 +159,11 @@ void average_sample(void)
 	putstr(")\r\n");
 }
 
+void timer_event_handler(void)
+{
+	wmp_start_sample();
+}
+
 void menu_handler(void);
 
 int main(void) {
@@ -170,6 +175,10 @@ int main(void) {
 
 	event_register(EVENT_UART_INPUT, menu_handler);
 
+	event_register(EVENT_I2C_COMPLETE, wmp_event_handler);
+
+	event_register(EVENT_TIMER, timer_event_handler);
+
 	putstr("Your entire life has been a mathematical error... a mathematical error I'm about to correct!\r\n");
 
 	putstr("prompt> ");
@@ -268,13 +277,12 @@ void menu_handler(void)
 			break;
 		case 'P':
 			putstr("Initialising timer... ");
-			timer_set_period(10000*TIMER_MS);
+			/* We want a 100Hz loop but two samples per iteration.
+			 * So, we go for 200Hz. */
+			timer_set_period(5*TIMER_MS);
 			reply("done");
+			wmp_start_zero();
 			break;
-		case 'E':
-			event_dispatch();
-			reply("done");
-			break;
 		default:
 			reply("Unrecognised command.");
 			break;