Serial 自動受信割り込み

serial name(tx, rx, p);

p : ポインタ

受信すると割り込みが発生して*pに受信した値が代入されます。

Revision:
0:d872f5a93d7b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serial.h	Sun Jan 17 04:33:00 2016 +0000
@@ -0,0 +1,27 @@
+#ifndef SERIAL_H
+#define SERIAL_H
+#include "mbed.h"
+
+class serial : public Serial
+{
+    public:
+    serial(PinName p1, PinName p2, int *p);
+    /*{
+        pdata = p;
+        baud(9600);
+        Serial::attach(this, &serial::getdata, Serial::RxIrq);
+    }*/
+    void getdata();
+    /*{
+        if(Serial::readable())
+        {
+            for(int i = 0;i < 8;i++)
+            *(pdata+i) = Serial::getc();
+        }
+    }*/
+    private:
+    int *pdata;
+};
+
+
+#endif
\ No newline at end of file