Serial Interrupt Library with mbed RTOS for multi-threading

Dependencies:   buffered-serial1 mbed-rtos mbed

Fork of Serial_interrupts by jim hamblen

Revision:
4:b6e538868312
Parent:
2:3d959c9fc9d7
Child:
8:df59d668cab1
--- a/main.cpp	Mon Dec 10 22:39:17 2012 +0000
+++ b/main.cpp	Mon Dec 10 22:43:18 2012 +0000
@@ -1,8 +1,6 @@
 #include "mbed.h"
 #include "buffered_serial.h"
-// Serial TX & RX interrupt loopback test using formatted IO - sprintf and sscanf
-// Connect TX to RX (p9 to p10)
-// or can also use USB and type back in the number printed out in a terminal window
+#include "rtos.h"
 // Sends out ASCII numbers in a loop and reads them back
 // If not the same number LED4 goes on
 // LED1 and LED2 indicate RX and TX interrupt routine activity
@@ -17,13 +15,12 @@
 char tx_line[80];
 char rx_line[80];
 
-// main test program
-int main()
+void serial_thread(const void *args)
 {
     int i=0;
     int rx_i=0;
     device.baud(9600);
-    
+
 // Formatted IO test using send and receive serial interrupts
 // with sprintf and sscanf
     while (1) {
@@ -65,3 +62,11 @@
     }
 }
 
+// main test program
+int main()
+{
+    Thread thread(serial_thread);
+    
+    while(1);
+}
+