Receive GPS by interrupt processing
Dependents: Sample_GPS_INT_lib GPS-SD
Diff: GPS_INT.h
- Revision:
- 0:4b6c377342d9
- Child:
- 1:fbe835e114bb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GPS_INT.h Sun Jul 08 02:30:46 2018 +0000 @@ -0,0 +1,65 @@ +/* +Copyright (c) 2018 @j_rocket_boy(Twitter) + +UART接続のGPSを割り込み処理で受信するライブラリ +このライブラリはMITライセンスです. + +Receive GPS of UART connection by interrupt processing +This library is released under the MIT License. + +About MIT license +https://opensource.org/licenses/mit-license.php +*/ + +#ifndef INCLUDED_GPS_INT_h_ +#define INCLUDED_GPS_INT_h_ +#include "mbed.h" + +class GPS_INT{ + +public: + + //コンストラクタ + GPS_INT(PinName tx, PinName rx, int baud = 9600); + //デストラクタ + virtual ~GPS_INT(); + + bool location_is_update(void); //位置情報が更新されたか(緯度,経度,DOP) + bool info_is_update(void); //それ以外の情報が更新されたか + bool is_lock(void); //GPSがロックしたか + + //受信する情報 + struct tm t; //時刻UTC + time_t seconds; //時刻(UTC1900年1月1日からの経過時間) + double lon; //緯度, 度(北緯が正) + double lat; //経度, 度(東経が正) + volatile int lock; //位置特定品質(0:位置特定できない, 1:SPS(標準測位サービス), 2:differencial GPS) + int n_sat; //使用衛星数 + float HDOP; //水平精度低下率 + float VDOP; //垂直精度低下率 + float PDOP; //位置精度低下率 + float h_see; //アンテナ海抜高さ, m + float h_geo; //ジオイド高さ, m + +private: + Serial gps; + bool location_update; + bool info_update; + int date_raw; //UTC 日付生データ + float time_raw; //UTC 時刻生データ + + double lon_raw; //緯度生データ + int lon_int; //緯度整数部 + double lon_minute; //緯度分 + char ns; //北緯or南緯 + + double lat_raw; //経度生データ + int lat_int; //経度整数部 + double lat_minute; //経度分 + char ew; //東経or西経 + + void get_char(void); + void gps_update(char* buffer); +}; + +#endif \ No newline at end of file