Colin Stearns
/
qcControl
QC Control software
Fork of dgps by
handle/handleCompass.h@66:5d43988d100c, 2014-05-05 (annotated)
- Committer:
- dylanembed123
- Date:
- Mon May 05 13:20:35 2014 +0000
- Revision:
- 66:5d43988d100c
- Parent:
- 44:2ae602b89961
Final Project;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
krobertson | 10:c4745ddaaf6a | 1 | #ifndef _HANDLECOMPASS_H_ |
krobertson | 10:c4745ddaaf6a | 2 | #define _HANDLECOMPASS_H_ |
krobertson | 10:c4745ddaaf6a | 3 | |
krobertson | 10:c4745ddaaf6a | 4 | #include "adapt/compass.h" |
krobertson | 44:2ae602b89961 | 5 | #include "adapt/usb.h" |
krobertson | 10:c4745ddaaf6a | 6 | |
krobertson | 10:c4745ddaaf6a | 7 | class compassHandle { |
krobertson | 10:c4745ddaaf6a | 8 | public: |
krobertson | 10:c4745ddaaf6a | 9 | /** |
krobertson | 10:c4745ddaaf6a | 10 | * \brief the last read compass heading |
krobertson | 10:c4745ddaaf6a | 11 | **/ |
krobertson | 10:c4745ddaaf6a | 12 | float heading; |
krobertson | 10:c4745ddaaf6a | 13 | |
krobertson | 10:c4745ddaaf6a | 14 | /** |
krobertson | 10:c4745ddaaf6a | 15 | * \brief constructor for the compass handle. Sets up the compass for reading. |
krobertson | 10:c4745ddaaf6a | 16 | **/ |
krobertson | 10:c4745ddaaf6a | 17 | compassHandle(); |
krobertson | 10:c4745ddaaf6a | 18 | |
krobertson | 10:c4745ddaaf6a | 19 | /** |
krobertson | 10:c4745ddaaf6a | 20 | * \brief sets up the compass for reading headings |
krobertson | 10:c4745ddaaf6a | 21 | **/ |
krobertson | 10:c4745ddaaf6a | 22 | void setup(); |
krobertson | 10:c4745ddaaf6a | 23 | |
krobertson | 10:c4745ddaaf6a | 24 | /** |
krobertson | 10:c4745ddaaf6a | 25 | * \brief gets an updated heading |
krobertson | 10:c4745ddaaf6a | 26 | **/ |
krobertson | 10:c4745ddaaf6a | 27 | void run(); |
krobertson | 44:2ae602b89961 | 28 | |
krobertson | 44:2ae602b89961 | 29 | static compassHandle* hand; |
krobertson | 44:2ae602b89961 | 30 | static compassHandle& getCompassHand(){ |
krobertson | 44:2ae602b89961 | 31 | if(hand == NULL){ |
krobertson | 44:2ae602b89961 | 32 | hand = new compassHandle(); |
krobertson | 44:2ae602b89961 | 33 | } |
krobertson | 44:2ae602b89961 | 34 | return *hand; |
krobertson | 44:2ae602b89961 | 35 | } |
krobertson | 44:2ae602b89961 | 36 | |
krobertson | 10:c4745ddaaf6a | 37 | private: |
krobertson | 10:c4745ddaaf6a | 38 | /** |
krobertson | 10:c4745ddaaf6a | 39 | * \brief reference to the compass adaptor |
krobertson | 10:c4745ddaaf6a | 40 | **/ |
krobertson | 10:c4745ddaaf6a | 41 | Compass compass; |
krobertson | 44:2ae602b89961 | 42 | |
krobertson | 44:2ae602b89961 | 43 | bool initialized; |
krobertson | 10:c4745ddaaf6a | 44 | }; |
krobertson | 10:c4745ddaaf6a | 45 | |
krobertson | 10:c4745ddaaf6a | 46 | #endif |