IZU2020 / PQAEGPS

Dependents:   IZU2020_AVIONICS IZU2020_AVIONICS

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PQAEGPS.h Source File

PQAEGPS.h

00001 #ifndef PQAEGPS_H
00002 #define PQAEGPS_H
00003 
00004 /**
00005  * AE-GPSのライブラリ
00006  * @note 内部でシリアル受信割り込みを使用しています
00007  * @note GPGGAフォーマットのみを出力するように設定し、バックアップ用電池を使用すること
00008  * @code
00009 #include "mbed.h"
00010 #include "PQAEGPS.h"
00011 
00012 Serial pc(USBTX, USBRX, 115200);
00013 Serial gps_serial(p9, p10, 115200);
00014 
00015 AEGPS gps(gps_serial);
00016 
00017 int main()
00018 {
00019     while(1) {
00020         pc.printf("lat:%.6f, lon:%.6f, time:%d:%d:%.1f, fix:%d, sat:%d, hdop:%.2f, alt:%.1f, geoid:%.1f\r\n", gps.get_lat(), gps.get_lon(), gps.get_hour(), gps.get_min(), gps.get_sec(), gps.get_fix(), gps.get_sat(), gps.get_sat(), gps.get_hdop(), gps.get_alt(), gps.get_geoid());
00021     }
00022 }
00023  * @endcode
00024  */
00025 class AEGPS
00026 {
00027 private:
00028     Serial *_serial;
00029     char rx_buf[256];
00030     int index;
00031     int flag;
00032     int hour;
00033     int min;
00034     float sec;
00035     float lat;
00036     char ns;
00037     float lon;
00038     char ew;
00039     int fix;
00040     int sat;
00041     float hdop;
00042     float alt;
00043     float geoid;
00044 
00045 public:
00046     /**
00047      * @param &gps_serial Serialのインスタンスへの参照
00048      */
00049     AEGPS (Serial &gps_serial);
00050 
00051 private:
00052     void receive();
00053 
00054 public:
00055     /**
00056      * 協定世界時(UTC)の時間のゲッター
00057      * @return 時間(UTC)
00058      */
00059     int get_hour();
00060 
00061     /**
00062      * 協定世界時(UTC)の分のゲッター
00063      * @return 分(UTC)
00064      */
00065     int get_min();
00066 
00067     /**
00068      * 協定世界時(UTC)の秒のゲッター
00069      * @return 秒(UTC)
00070      */
00071     float get_sec();
00072 
00073     /**
00074      * 緯度のゲッター
00075      * @return 緯度
00076      */
00077     float get_lat();
00078 
00079     /**
00080      * 経度のゲッター
00081      * @return 経度
00082      */
00083     float get_lon();
00084 
00085     /**
00086      * 位置特定品質のゲッター
00087      * @return 位置特定品質
00088      */
00089     int get_fix();
00090 
00091     /**
00092      * 使用衛星数のゲッター
00093      * @return 使用衛星数
00094      */
00095     int get_sat();
00096 
00097     /**
00098      * 水平精度低下率のゲッター
00099      * @return 水平精度低下率
00100      */
00101     float get_hdop();
00102 
00103     /**
00104      * 海抜高さのゲッター
00105      * @return 海抜高さ
00106      */
00107     float get_alt();
00108 
00109     /**
00110      * ジオイド高さのゲッター
00111      * @return ジオイド高さ
00112      */
00113     float get_geoid();
00114 };
00115 
00116 #endif