Simple driver for GNSS functions on BG96 module.
Dependents: mbed-os-example-cellular-gps-bg96
Note: this is early version
BG96 module needs to be already running to use this. Configuration only inside of this class. (hardcoded values)
BG96_GNSS.h
- Committer:
- Pawel Zarembski
- Date:
- 2020-02-19
- Revision:
- 0:6a2a480672be
- Child:
- 1:c3a5d3a0b437
File content as of revision 0:6a2a480672be:
#ifndef BG96_GNSS_H #define BG96_GNSS_H #include "mbed.h" #define SUCCESS 0 #define FAILURE 1 #define BG96_AT_TIMEOUT 1000 class BG96_GNSS { public: typedef struct gps_data_t { float utc; // hhmmss.sss float lat; // latitude. (-)dd.ddddd float lon; // longitude. (-)dd.ddddd float hdop; // Horizontal precision: 0.5-99.9 float altitude; // altitude of antenna from sea level (meters) int fix; // GNSS position mode 2=2D, 3=3D float cog; // Course Over Ground ddd.mm float spkm; // Speed over ground (Km/h) xxxx.x float spkn; // Speed over ground (knots) xxxx.x char date[7]; // data: ddmmyy int nsat; // number of satellites 0-12 } gps_data; // todo: include gps data type in name BG96_GNSS(bool debug = false); /* init methods */ void serial_at_parser_init(const char *delimiter, bool debug_en); void check_if_ready(void); int set_gps_power(bool state); /* module check state methods */ /* data acquisition methods */ int get_gps_data(gps_data *data); private: UARTSerial *_serial; ATCmdParser *_parser; }