![](/media/cache/profiles/2012_sf_avc_095.jpg.50x50_q85.jpg)
2018 revision to classic DataBus AVC code.
Dependencies: LSM303DLM Servo SerialGraphicLCD L3G4200D IncrementalEncoder SimpleShell
Ublox6.h@16:eb28d0f64a9b, 2018-12-13 (annotated)
- Committer:
- shimniok
- Date:
- Thu Dec 13 17:35:29 2018 +0000
- Revision:
- 16:eb28d0f64a9b
- Child:
- 18:3f8a8f6e3cc1
Initial gps receive implementation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shimniok | 16:eb28d0f64a9b | 1 | #ifndef __UBLOX6_H |
shimniok | 16:eb28d0f64a9b | 2 | #define __UBLOX6_H |
shimniok | 16:eb28d0f64a9b | 3 | |
shimniok | 16:eb28d0f64a9b | 4 | /** uBlox GPS UBX Protocol Reader |
shimniok | 16:eb28d0f64a9b | 5 | * Parses uBlox GPS binary protocol |
shimniok | 16:eb28d0f64a9b | 6 | * |
shimniok | 16:eb28d0f64a9b | 7 | * @author Wayne Holder; Ported to mbed by Michael Shimniok |
shimniok | 16:eb28d0f64a9b | 8 | */ |
shimniok | 16:eb28d0f64a9b | 9 | #include "mbed.h" |
shimniok | 16:eb28d0f64a9b | 10 | |
shimniok | 16:eb28d0f64a9b | 11 | class Ublox6 { |
shimniok | 16:eb28d0f64a9b | 12 | public: |
shimniok | 16:eb28d0f64a9b | 13 | // TODO 3 convert this to time units |
shimniok | 16:eb28d0f64a9b | 14 | static const int lag=40; // number of updater steps by which gps output lags reality |
shimniok | 16:eb28d0f64a9b | 15 | |
shimniok | 16:eb28d0f64a9b | 16 | /** |
shimniok | 16:eb28d0f64a9b | 17 | * UBX protocol parser (Wayne Holder) |
shimniok | 16:eb28d0f64a9b | 18 | * @param cc is the character to parse |
shimniok | 16:eb28d0f64a9b | 19 | * @note stores parsed gps data in member variables and sets _available |
shimniok | 16:eb28d0f64a9b | 20 | * to true to indicate gps data is waiting. |
shimniok | 16:eb28d0f64a9b | 21 | */ |
shimniok | 16:eb28d0f64a9b | 22 | void parse(unsigned char cc); |
shimniok | 16:eb28d0f64a9b | 23 | |
shimniok | 16:eb28d0f64a9b | 24 | /** |
shimniok | 16:eb28d0f64a9b | 25 | * get latitude |
shimniok | 16:eb28d0f64a9b | 26 | */ |
shimniok | 16:eb28d0f64a9b | 27 | double latitude(void); |
shimniok | 16:eb28d0f64a9b | 28 | |
shimniok | 16:eb28d0f64a9b | 29 | /** |
shimniok | 16:eb28d0f64a9b | 30 | * get longitude |
shimniok | 16:eb28d0f64a9b | 31 | */ |
shimniok | 16:eb28d0f64a9b | 32 | double longitude(void); |
shimniok | 16:eb28d0f64a9b | 33 | |
shimniok | 16:eb28d0f64a9b | 34 | /** |
shimniok | 16:eb28d0f64a9b | 35 | * Get Horizontal Dilution of Precision |
shimniok | 16:eb28d0f64a9b | 36 | * @return float horizontal dilution of precision |
shimniok | 16:eb28d0f64a9b | 37 | */ |
shimniok | 16:eb28d0f64a9b | 38 | float hdop(void); |
shimniok | 16:eb28d0f64a9b | 39 | |
shimniok | 16:eb28d0f64a9b | 40 | /** |
shimniok | 16:eb28d0f64a9b | 41 | * get count of active satellites |
shimniok | 16:eb28d0f64a9b | 42 | */ |
shimniok | 16:eb28d0f64a9b | 43 | int sat_count(void); |
shimniok | 16:eb28d0f64a9b | 44 | |
shimniok | 16:eb28d0f64a9b | 45 | /** |
shimniok | 16:eb28d0f64a9b | 46 | * get speed in m/s |
shimniok | 16:eb28d0f64a9b | 47 | */ |
shimniok | 16:eb28d0f64a9b | 48 | float speed_mps(void); |
shimniok | 16:eb28d0f64a9b | 49 | |
shimniok | 16:eb28d0f64a9b | 50 | /** |
shimniok | 16:eb28d0f64a9b | 51 | * get heading in degrees |
shimniok | 16:eb28d0f64a9b | 52 | */ |
shimniok | 16:eb28d0f64a9b | 53 | float heading_deg(void); |
shimniok | 16:eb28d0f64a9b | 54 | |
shimniok | 16:eb28d0f64a9b | 55 | /** |
shimniok | 16:eb28d0f64a9b | 56 | * determine if data is available to be used |
shimniok | 16:eb28d0f64a9b | 57 | */ |
shimniok | 16:eb28d0f64a9b | 58 | bool available(void); |
shimniok | 16:eb28d0f64a9b | 59 | |
shimniok | 16:eb28d0f64a9b | 60 | /** |
shimniok | 16:eb28d0f64a9b | 61 | * reset the data available flag |
shimniok | 16:eb28d0f64a9b | 62 | */ |
shimniok | 16:eb28d0f64a9b | 63 | void reset_available(void); |
shimniok | 16:eb28d0f64a9b | 64 | |
shimniok | 16:eb28d0f64a9b | 65 | private: |
shimniok | 16:eb28d0f64a9b | 66 | int _available; // is data available? |
shimniok | 16:eb28d0f64a9b | 67 | float _latitude; // temp storage, latitude |
shimniok | 16:eb28d0f64a9b | 68 | float _longitude; // temp storage, longitude |
shimniok | 16:eb28d0f64a9b | 69 | float _hdop; // horiz dilution of precision |
shimniok | 16:eb28d0f64a9b | 70 | float _course_deg; // course in degrees |
shimniok | 16:eb28d0f64a9b | 71 | float _speed_mps; // speed in m/s |
shimniok | 16:eb28d0f64a9b | 72 | int _sat_count; // satellite count |
shimniok | 16:eb28d0f64a9b | 73 | }; |
shimniok | 16:eb28d0f64a9b | 74 | |
shimniok | 16:eb28d0f64a9b | 75 | #endif |