123123123123123123123123123

Dependencies:   mbed

Revision:
3:4306d042af6f
Parent:
2:442902ec3aa1
--- a/compass.h	Thu Jul 03 10:59:37 2014 +0000
+++ b/compass.h	Thu Jul 03 14:52:44 2014 +0000
@@ -22,7 +22,7 @@
 #define COMPASS_TX      p9
 #define COMPASS_RX      p10
 
-
+#define _BUFFER_SIZE 512
 
 #define DECLINATIONANGLE  -0.0457
 #define OFFSET 0
@@ -31,28 +31,35 @@
 
 class COMPASS 
 {
-
 public:
+    COMPASS(MySerial* serial);
+    uint16_t read();
+    void putToBuffer(uint8_t data);
 
-   COMPASS(PinName TX, PinName RX);
-    uint16_t read();
-    
     
 private:
-     
-    MySerial *serial;
-    char buffer[2];
-    uint16_t degree;
+    MySerial* _serial;
+    uint16_t _degree;
+    uint8_t flag;
+    uint8_t count;
+    float declinationAngle;
+    int offset;
+    uint16_t buffer_count;
+    char temp[2];
+    char buffer[_BUFFER_SIZE];
+    uint16_t twobytes;
+    uint8_t hundreds,tens,digits;
     
     void init();
+    void write2Bytes(char msb, char lsb);
+    
     void run();
     void stop();
     void resume();
     void reset();
-    void write2Bytes(char msb, char lsb);
     
-    float declinationAngle;
-    int offset;
+  //  void check_time_out();
+//    void time_out_init();
 };
 
 #endif /* COMPASS_H */
\ No newline at end of file