Buffered Serial Port Driver for RTOS

Dependents:   nucleo_cannonball PiballNeoController

Buffered Serial Port Driver for RTOS

  • ISR driven, ring buffered IO operation
  • IO operations are idle waiting, don't waste time in RTOS :D
  • Can use external buffers
  • Based on mbed RawSerial

Example

SerialDriver Example

#include "SerialDriver.h"

SerialDriver pc(USBTX, USBRX);

int main()
{
    // setup serial port
    pc.baud(9600);
    
    // print some text
    pc.puts("This is just a string.\r\n");
    pc.printf("But this is a %s with integer %i and float %f.\r\n", "formatted text", 123, 0.456f);
    
    // now lets behave like a null modem 
    while(1)
       pc.putc(pc.getc());
}

Look at the API Documentation for more Examples.

Dependencies

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Import librarymbed-rtos

Official mbed Real Time Operating System based on the RTX implementation of the CMSIS-RTOS API open standard.

If you find a bug, please help me to fix it. Send me a message. You can help me a lot: Write a demo program that causes the bug reproducible.

History

Beta Update: Could SerialDriver inherit RawSerial rather than SerialBase? Maybe, let's try! default tip

2015-10-29, by BlazeX [Thu, 29 Oct 2015 19:38:11 +0000] rev 8

Beta Update: Could SerialDriver inherit RawSerial rather than SerialBase? Maybe, let's try!


A sneaky bug was removed. Thanks to Remi Beges for the hint.

2015-10-27, by BlazeX [Tue, 27 Oct 2015 17:51:30 +0000] rev 7

A sneaky bug was removed. Thanks to Remi Beges for the hint.


Fixed TX IRQ problem on KL25Z and KL46Z.

2015-10-25, by BlazeX [Sun, 25 Oct 2015 20:44:56 +0000] rev 6

Fixed TX IRQ problem on KL25Z and KL46Z.


BETA update

2015-10-23, by BlazeX [Fri, 23 Oct 2015 13:55:39 +0000] rev 5

BETA update
; logical issue ^^


BETA update.

2015-10-23, by BlazeX [Fri, 23 Oct 2015 13:49:19 +0000] rev 4

BETA update.
; Trying to make SerialDriver compatible with KL25Z and KL46Z. Test at your own risk.


Added dropped bytes counters, they indicate too small buffers.

2015-01-26, by BlazeX [Mon, 26 Jan 2015 19:21:56 +0000] rev 3

Added dropped bytes counters, they indicate too small buffers.


Removed dependencies from the library.

2015-01-15, by BlazeX [Thu, 15 Jan 2015 09:53:09 +0000] rev 2

Removed dependencies from the library.


Fixed Dependencies.

2015-01-15, by BlazeX [Thu, 15 Jan 2015 09:00:48 +0000] rev 1

Fixed Dependencies.


Release :)

2015-01-14, by BlazeX [Wed, 14 Jan 2015 16:30:14 +0000] rev 0

Release :)