Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of ESDC2014 by
Diff: compass.h
- Revision:
- 3:4306d042af6f
- Parent:
- 2:442902ec3aa1
- Child:
- 4:a377ecb9364f
diff -r 442902ec3aa1 -r 4306d042af6f compass.h
--- 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
