serial to processing

Revision:
0:d392bb39c8b8
diff -r 000000000000 -r d392bb39c8b8 serial.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serial.h	Sat Nov 05 07:01:59 2016 +0000
@@ -0,0 +1,71 @@
+#ifndef SERIAL_H
+#define SERIAL_H
+#include "mbed.h"
+
+class serial : public Serial
+{
+    public:
+    serial(PinName tx, PinName rx, char *_Registar);/* : Serial(tx, rx);
+    {
+        Registar = _Registar;
+        DATA = 0;
+        count = 0;
+        for(int i = 0; i < 4; i++)arrayDATA[i] = 0;
+        baud(115200);
+        attach(this, &serial::getdata, Serial::RxIrq);
+    }*/
+    
+    void getdata();
+    /*{
+        if(readable())
+        {
+            count = getc();
+            if(count <= 3 && count >= 0)
+            {
+                putc(arrayDATA[count]);
+            }
+            else
+            {
+                //if(readable())    //No
+                *( Registar + (count-4) ) = getc();
+            }
+        }
+    }*/
+
+    int getdata(int reg, int size);
+    /*{
+        int data = 0;
+        for(int i = 0; i < size; i++)
+        {
+            data  |= *(Registar + + reg + i) << (i*8);
+        }
+        return data;
+    }*/
+    
+    void putpc(const int data);
+    /*{
+        DATA = data;
+        for(int i = 0; i < 4; i++)
+        {
+            arrayDATA[i] = ( DATA >> (i*8) ) & 0x0ff;
+        }
+    }*/
+    
+    int operator[](int reg);
+    /*{
+        return getdata(reg, 4);
+    }*/
+    
+    void operator=(const int data);
+    /*{
+        putpc(data);
+    }*/
+    
+    private:
+    int DATA;
+    int arrayDATA[4];
+    int count;
+    char *Registar;
+};
+
+#endif
\ No newline at end of file