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
Diff: rtos_serial.cpp
- Revision:
- 15:5f38a747ba08
- Parent:
- 14:33d60e4eb215
- Child:
- 16:2d3937773625
--- a/rtos_serial.cpp Thu Oct 24 20:31:25 2013 +0000 +++ b/rtos_serial.cpp Wed Oct 30 04:58:10 2013 +0000 @@ -22,7 +22,7 @@ /* TODO: * - size the tx thread stack - * - make an rx buffer thread + * - make an rx buffer thread? * - implement readable() * - implement writeable() somehow */