Joaquin Verastegui / jro

Dependents:   JRO_CR2 frdm_test

Fork of jro by Miguel Urco

Revision:
2:3d8d52e9751c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/JroSerial.h	Thu Feb 05 19:01:42 2015 +0000
@@ -0,0 +1,30 @@
+#include "mbed.h"
+#include "rtos.h"
+#include "SerialDriver.h"
+
+class JroSerial: public SerialDriver
+{
+
+    private:
+        
+        SerialDriver *screen;
+        char* rx_buffer;
+        
+        //Semaphore rx_sem;
+        //Semaphore tx_sem;
+    protected:
+        inline void disableTxInterrupt()   {    serial_irq_set(&_serial, (SerialIrq)TxIrq, 0);    }
+        inline void enableTxInterrupt()    {    serial_irq_set(&_serial, (SerialIrq)TxIrq, 1);    }
+        
+        inline void disableRxInterrupt()   {    serial_irq_set(&_serial, (SerialIrq)RxIrq, 0);    }
+        inline void enableRxInterrupt()    {    serial_irq_set(&_serial, (SerialIrq)RxIrq, 1);    } 
+    
+    public:
+        
+        IRQn device_irqn;
+        
+        JroSerial(PinName tx, PinName rx, SerialDriver *screen);
+        int Init(int baudrate);
+        int ReadData(char* rx_buffer);
+        void Rx_interrupt();
+};