This my big project for PYRN Board
Dependencies: CAN HTTPClient MODSERIAL MyThings Pyrn3GModem Socket TinyGPS MyUSBHost lwip-sys lwip mbed-rtos mbed-src
GPSSensor.h@0:efe6085327fd, 2015-04-14 (annotated)
- Committer:
- clemounet
- Date:
- Tue Apr 14 13:30:02 2015 +0000
- Revision:
- 0:efe6085327fd
All the projet PYRN 3G-CAN-ACC...
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
clemounet | 0:efe6085327fd | 1 | #ifndef GPS_SENSOR_H |
clemounet | 0:efe6085327fd | 2 | #define GPS_SENSOR_H |
clemounet | 0:efe6085327fd | 3 | |
clemounet | 0:efe6085327fd | 4 | #include "mbed.h" |
clemounet | 0:efe6085327fd | 5 | #include "MySensor.h" |
clemounet | 0:efe6085327fd | 6 | #include "MODSERIAL.h" |
clemounet | 0:efe6085327fd | 7 | #include "TinyGPS.h" |
clemounet | 0:efe6085327fd | 8 | |
clemounet | 0:efe6085327fd | 9 | #define GPS_STORE_SIZE 256 |
clemounet | 0:efe6085327fd | 10 | #define GPS_RECV_BUFF 512 |
clemounet | 0:efe6085327fd | 11 | |
clemounet | 0:efe6085327fd | 12 | class GPSSensor: public MySensor { |
clemounet | 0:efe6085327fd | 13 | protected: |
clemounet | 0:efe6085327fd | 14 | TinyGPS gpsParser; |
clemounet | 0:efe6085327fd | 15 | enum frameType{ |
clemounet | 0:efe6085327fd | 16 | GGA = 1, |
clemounet | 0:efe6085327fd | 17 | RMC = 2 |
clemounet | 0:efe6085327fd | 18 | }; |
clemounet | 0:efe6085327fd | 19 | typedef struct _gpsImpact{ |
clemounet | 0:efe6085327fd | 20 | uint32_t date; |
clemounet | 0:efe6085327fd | 21 | uint32_t time; |
clemounet | 0:efe6085327fd | 22 | int32_t lon; |
clemounet | 0:efe6085327fd | 23 | int32_t lat; |
clemounet | 0:efe6085327fd | 24 | int32_t alt; |
clemounet | 0:efe6085327fd | 25 | uint16_t hdop; |
clemounet | 0:efe6085327fd | 26 | } __attribute__((packed)) gpsImpact; |
clemounet | 0:efe6085327fd | 27 | uint8_t recvBuff[GPS_RECV_BUFF]; |
clemounet | 0:efe6085327fd | 28 | uint8_t store[GPS_STORE_SIZE]; |
clemounet | 0:efe6085327fd | 29 | gpsImpact impact; |
clemounet | 0:efe6085327fd | 30 | MODSERIAL gps; |
clemounet | 0:efe6085327fd | 31 | //Serial gps; |
clemounet | 0:efe6085327fd | 32 | uint32_t trackTime; |
clemounet | 0:efe6085327fd | 33 | uint32_t lastImpact; |
clemounet | 0:efe6085327fd | 34 | bool fixed; |
clemounet | 0:efe6085327fd | 35 | public: |
clemounet | 0:efe6085327fd | 36 | GPSSensor(PinName tx, PinName rx, uint32_t trackingTime = 10, uint32_t idle = 250); |
clemounet | 0:efe6085327fd | 37 | virtual void InitResultsStatic(void); |
clemounet | 0:efe6085327fd | 38 | virtual void Loop(void); |
clemounet | 0:efe6085327fd | 39 | virtual void StoreLastImpact(void); |
clemounet | 0:efe6085327fd | 40 | virtual bool NeedImpact(void); |
clemounet | 0:efe6085327fd | 41 | virtual int GetLine(void); |
clemounet | 0:efe6085327fd | 42 | virtual void Sample(void); |
clemounet | 0:efe6085327fd | 43 | }; |
clemounet | 0:efe6085327fd | 44 | |
clemounet | 0:efe6085327fd | 45 | #endif //GPS_SENSOR_H |