Buffered Serial Port Driver for RTOS tested with a K64F

Dependents:   JRO_CR2 frdm_test JRO_DDSv2 JRO_DDSv2_rev2019

Fork of SerialDriver by BlazeX .

Revision:
5:ee58295c58e1
Parent:
4:3956012cd0c4
--- a/SerialDriver.cpp	Thu Feb 05 19:03:30 2015 +0000
+++ b/SerialDriver.cpp	Tue Feb 10 14:29:32 2015 +0000
@@ -41,26 +41,12 @@
     
     // attach interrupt routines
     attach(this, &SerialDriver::onRxIrq, RxIrq);
-    //attach(this, &SerialDriver::onTxIrq, TxIrq);
+    #if !defined(TARGET_K64F)
+        attach(this, &SerialDriver::onTxIrq, TxIrq);
+    #endif
 }
 
-int SerialDriver::putc(int c, unsigned int timeoutMs)
-{
-    
-    while(!SerialBase::writeable())
-    {//wait until character had been sent
-        Thread::wait(1);
-    }
-    
-    if(SerialBase::writeable())
-    {
-        // take byte from tx buffer and put it out
-        SerialBase::_base_putc(c);
-    }
-    
-    return 1;
-}
-/*
+#if !defined(TARGET_K64F)
 int SerialDriver::putc(int c, unsigned int timeoutMs)
 {
     // critical section, isr could modify cursors
@@ -97,7 +83,25 @@
     
     return 1;
 }
-*/
+#else
+int SerialDriver::putc(int c, unsigned int timeoutMs)
+{
+    
+    while(!SerialBase::writeable())
+    {//wait until character had been sent
+        Thread::wait(1);
+    }
+    
+    if(SerialBase::writeable())
+    {
+        // take byte from tx buffer and put it out
+        SerialBase::_base_putc(c);
+    }
+    
+    return 1;
+}
+#endif
+
 void SerialDriver::onTxIrq()
 {
     // prevent fire another TxIrq now