Dependents: mbed-os-example-mbed5-wifi
Diff: stm32l475e_iot01_gps.h
- Revision:
- 0:81d4b52c0083
diff -r 000000000000 -r 81d4b52c0083 stm32l475e_iot01_gps.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stm32l475e_iot01_gps.h Fri Jan 15 13:21:24 2021 +0000 @@ -0,0 +1,43 @@ + +#include "mbed.h" + +#ifndef __STM32L475E_IOT01_GPS_H +#define __STM32L475E_IOT01_GPS_H + +/** A GPS interface for reading from a Globalsat EM-406 GPS Module */ +class GPS { +public: + + /** Create the GPS interface, connected to the specified serial port + */ + GPS(PinName tx, PinName rx); + + /** Sample the incoming GPS data, returning whether there is a lock + * + * @return 1 if there was a lock when the sample was taken (and therefore .longitude and .latitude are valid), else 0 + */ + int sample(); + + /** The longitude (call sample() to set) */ + float longitude; + + /** The latitude (call sample() to set) */ + float latitude; + + int num_sat; + float hori_dilute; + float alt; + float geoid, time; + char ns, ew; + char gu, hu; + +private: + float trunc(float v); + void getline(); + + Serial _gps; + char msg[256]; + +}; + +#endif \ No newline at end of file