ok

Dependents:   pixy2 pixy2_10_0042 0000Non_stop_code_v1 0000Non_stop_code_v3 ... more

Fork of pixy by Arcadie Cracan

Revision:
0:ed8dc4531ac1
Child:
2:4bc00ec184a8
diff -r 000000000000 -r ed8dc4531ac1 PixyLinkUART.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PixyLinkUART.h	Sun Nov 16 11:52:55 2014 +0000
@@ -0,0 +1,34 @@
+#ifndef TUIASI_PIXYLINKUART_H
+#define TUIASI_PIXYLINKUART_H
+
+#include "Serial.h"
+#include "PixyLink.h"
+
+class PixyLinkUART : public PixyLink, private Serial
+{
+public:
+    PixyLinkUART(PinName tx, PinName rx) :
+        Serial(tx, rx) {
+        baud(19200);
+    };
+
+    virtual uint16_t getWord() {
+        uint8_t data[2] = {0, 0};
+        read(data, 2);
+        return ((uint16_t)data[1] << 8) | data[0];
+    };
+
+    virtual uint8_t getByte() {
+        uint8_t data = 0;
+        read(&data, 1);
+        return data;
+    };
+
+    virtual int8_t send(uint8_t *data, uint8_t len) {
+        return write(data, len);
+    };
+
+
+private:
+};
+#endif //TUIASI_PIXYLINKUART_H
\ No newline at end of file