Serial Interrupt Library with mbed RTOS for multi-threading

Dependencies:   buffered-serial1 mbed-rtos mbed

Fork of Serial_interrupts by jim hamblen

Files at this revision

API Documentation at this revision

Comitter:
tylerjw
Date:
Mon Dec 10 22:43:18 2012 +0000
Parent:
3:2f8f50256c2e
Child:
5:52705b8ccb32
Commit message:
placed in thread

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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);
+}
+