Serial communication protocol generic implementation

Dependents:   ClassFRDM ClassLPC

Revision:
0:60c4436f7667
Child:
1:9cfb17f74dcd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DataComm.h	Thu Mar 19 02:36:11 2015 +0000
@@ -0,0 +1,40 @@
+//data comm functions
+//serial communication protocol
+
+#ifndef DATACOMM_H
+#define DATACOMM_H
+
+#define PREAMBLE 0x7E
+
+#include "mbed.h"
+#include "platform.h"
+#include "gpio_api.h"
+
+class DataComm {
+
+    public:
+        void setClockOut(PinName pin);
+        void setClockIn(PinName pin);
+        void setSerialOut(PinName pin);
+        void setSerialIn(PinName pin);        
+        void listen();
+        void setClock(int clock);
+        void initiate_connection();
+        void setDataSize(int size);
+        void send_data(char data[]);
+        char* receive_data();
+    
+    
+    
+    protected:
+        gpio_t clock_out;
+        gpio_t clock_in;        
+        gpio_t serial_out;
+        gpio_t serial_in;
+        int clock_time;
+        int skew_time;
+        int data_size;
+        Timer t;     
+};
+
+#endif
\ No newline at end of file