An RTOS-friendly Serial interface Its primary benefit is that it never hogs the CPU. An amusing alternative to the traditional ring-bufferd interrupt-serviced systems, it uses short mbed-rtos queues to buffer characters to and from the UART, and a thread to service the transmitter. Short interrupt service routines enqueue received characters and signal the transmit thread when the transmitter is available. WARNING: Do not create RTOS-Serial objects before the RTOS is running! Put them inside your main() block or another function, not in the global initialization.

Dependents:   Test_RDM880_rfid_reader

Revision:
13:2fb32235253c
Parent:
12:be7883573c91
Child:
14:33d60e4eb215
diff -r be7883573c91 -r 2fb32235253c rtos_serial.h
--- a/rtos_serial.h	Thu Oct 24 17:30:52 2013 +0000
+++ b/rtos_serial.h	Thu Oct 24 18:25:14 2013 +0000
@@ -107,10 +107,9 @@
     int parent_putc(int);
     
     static void threadStarter(void const *p);
-    void tx_emitter(void const *argument);
+    void tx_emitter();
     
     Thread _tx_thread;
-    Thread* tx_emitter_threadp;
     void rx_isr();
     void tx_isr();
 };