GPS module (GYSFDMAXB) 57600 bps
Dependents: HAPS_GPS_Test_0001
GYSFDMAXB GPSセンサーGYSFDMAXBのライブラリ 57600 bps
手順 [1] シリアルピンを設定 GYSFDMAXB gps(tx_pin, rx_pin); [2] 零点を設定する(NED座標系における零点) gps.Initialize(); [3] 自動的にデータを受信しては更新していくので、適宜メンバ変数を読み込んで使う
GYSFDMAXB.hpp@8:9b573e4c4a85, 2021-04-23 (annotated)
- Committer:
- cocorlow
- Date:
- Fri Apr 23 12:34:55 2021 +0000
- Revision:
- 8:9b573e4c4a85
- Parent:
- 5:6fc37ae3f262
- Child:
- 9:8595608c56ca
4096 buffer
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cocorlow | 5:6fc37ae3f262 | 1 | #ifndef __GYSFDMAXB_HPP__ |
cocorlow | 5:6fc37ae3f262 | 2 | #define __GYSFDMAXB_HPP__ |
cocorlow | 5:6fc37ae3f262 | 3 | |
cocorlow | 5:6fc37ae3f262 | 4 | #include "mbed.h" |
cocorlow | 5:6fc37ae3f262 | 5 | #include "Vector3.hpp" |
cocorlow | 5:6fc37ae3f262 | 6 | |
cocorlow | 5:6fc37ae3f262 | 7 | /* |
cocorlow | 5:6fc37ae3f262 | 8 | $GPZDA,030049.971,06,04,2021,,*54 |
cocorlow | 5:6fc37ae3f262 | 9 | $GPGGA,030050.971,,,,,0,0,,,M,,M,,*41 |
cocorlow | 5:6fc37ae3f262 | 10 | $GPGLL,,,,,030050.971,V,N*73 |
cocorlow | 5:6fc37ae3f262 | 11 | $GPGSA,A,1,,,,,,,,,,,,,,,*1E |
cocorlow | 5:6fc37ae3f262 | 12 | $GPGSV,1,1,00*79 |
cocorlow | 5:6fc37ae3f262 | 13 | $GPRMC,030050.971,V,,,,,0.00,0.00,060421,,,N*45 |
cocorlow | 5:6fc37ae3f262 | 14 | $GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32 |
cocorlow | 5:6fc37ae3f262 | 15 | $GPZDA,030050.971,06,04,2021,,*5C |
cocorlow | 5:6fc37ae3f262 | 16 | $GPGGA,030051.971,,,,,0,0,,,M,,M,,*40 |
cocorlow | 5:6fc37ae3f262 | 17 | $GPGLL,,,,,030051.971,V,N*72 |
cocorlow | 5:6fc37ae3f262 | 18 | $GPGSA,A,1,,,,,,,,,,,,,,,*1E |
cocorlow | 5:6fc37ae3f262 | 19 | $GPGSV,1,1,00*79 |
cocorlow | 5:6fc37ae3f262 | 20 | $GPRMC,030051.971,V,,,,,0.00,0.00,060421,,,N*44 |
cocorlow | 5:6fc37ae3f262 | 21 | $GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32 |
cocorlow | 5:6fc37ae3f262 | 22 | $GPZDA,030051.971,06,04,2021,,*5D |
cocorlow | 5:6fc37ae3f262 | 23 | */ |
cocorlow | 5:6fc37ae3f262 | 24 | |
cocorlow | 5:6fc37ae3f262 | 25 | |
cocorlow | 5:6fc37ae3f262 | 26 | class GYSFDMAXB |
cocorlow | 5:6fc37ae3f262 | 27 | { |
cocorlow | 5:6fc37ae3f262 | 28 | private: |
cocorlow | 5:6fc37ae3f262 | 29 | Serial serial; |
cocorlow | 5:6fc37ae3f262 | 30 | volatile bool receive_flag; |
cocorlow | 5:6fc37ae3f262 | 31 | const int start_size = 32; |
cocorlow | 5:6fc37ae3f262 | 32 | char* uart_start[start_size]; |
cocorlow | 5:6fc37ae3f262 | 33 | volatile int start_index; |
cocorlow | 8:9b573e4c4a85 | 34 | const int uart_size = 4096; |
cocorlow | 5:6fc37ae3f262 | 35 | char uart_buffer[uart_size]; |
cocorlow | 5:6fc37ae3f262 | 36 | volatile int uart_index; |
cocorlow | 5:6fc37ae3f262 | 37 | Ticker timer; |
cocorlow | 5:6fc37ae3f262 | 38 | |
cocorlow | 5:6fc37ae3f262 | 39 | static const float Radius = 6378136.6f; |
cocorlow | 5:6fc37ae3f262 | 40 | |
cocorlow | 5:6fc37ae3f262 | 41 | void Receive(); |
cocorlow | 5:6fc37ae3f262 | 42 | void Punctuate(); |
cocorlow | 5:6fc37ae3f262 | 43 | |
cocorlow | 5:6fc37ae3f262 | 44 | public: |
cocorlow | 5:6fc37ae3f262 | 45 | // GPGGA |
cocorlow | 5:6fc37ae3f262 | 46 | |
cocorlow | 5:6fc37ae3f262 | 47 | int Quality; |
cocorlow | 5:6fc37ae3f262 | 48 | int Satellites; |
cocorlow | 5:6fc37ae3f262 | 49 | float HDOP; |
cocorlow | 5:6fc37ae3f262 | 50 | float Elevation; |
cocorlow | 5:6fc37ae3f262 | 51 | char UnitElevation; |
cocorlow | 5:6fc37ae3f262 | 52 | float GeoidElevation; |
cocorlow | 5:6fc37ae3f262 | 53 | char UnitGeoidElevation; |
cocorlow | 5:6fc37ae3f262 | 54 | |
cocorlow | 5:6fc37ae3f262 | 55 | // GPRMC |
cocorlow | 5:6fc37ae3f262 | 56 | int Hours; |
cocorlow | 5:6fc37ae3f262 | 57 | int Minutes; |
cocorlow | 5:6fc37ae3f262 | 58 | int Seconds; |
cocorlow | 5:6fc37ae3f262 | 59 | int Milliseconds; |
cocorlow | 5:6fc37ae3f262 | 60 | char Status; |
cocorlow | 5:6fc37ae3f262 | 61 | float Latitude; |
cocorlow | 5:6fc37ae3f262 | 62 | char N_S; |
cocorlow | 5:6fc37ae3f262 | 63 | float Longitude; |
cocorlow | 5:6fc37ae3f262 | 64 | char E_W; |
cocorlow | 5:6fc37ae3f262 | 65 | float Speed; |
cocorlow | 5:6fc37ae3f262 | 66 | float Direction; |
cocorlow | 5:6fc37ae3f262 | 67 | int Day; |
cocorlow | 5:6fc37ae3f262 | 68 | int Month; |
cocorlow | 5:6fc37ae3f262 | 69 | int Year; |
cocorlow | 5:6fc37ae3f262 | 70 | float GeomagneticDeclination ; |
cocorlow | 5:6fc37ae3f262 | 71 | char GeomagneticE_W; |
cocorlow | 5:6fc37ae3f262 | 72 | char Mode; |
cocorlow | 5:6fc37ae3f262 | 73 | |
cocorlow | 5:6fc37ae3f262 | 74 | Vector3 UniversalZeroPosition; |
cocorlow | 5:6fc37ae3f262 | 75 | Vector3 UniversalZeroUnitN; |
cocorlow | 5:6fc37ae3f262 | 76 | Vector3 UniversalZeroUnitE; |
cocorlow | 5:6fc37ae3f262 | 77 | Vector3 UniversalZeroUnitD; |
cocorlow | 5:6fc37ae3f262 | 78 | Vector3 UniversalPosition; |
cocorlow | 5:6fc37ae3f262 | 79 | Vector3 Position; |
cocorlow | 5:6fc37ae3f262 | 80 | |
cocorlow | 5:6fc37ae3f262 | 81 | GYSFDMAXB(PinName tx, PinName rx); |
cocorlow | 5:6fc37ae3f262 | 82 | void Update(); |
cocorlow | 5:6fc37ae3f262 | 83 | void Initialize(); |
cocorlow | 5:6fc37ae3f262 | 84 | Vector3 ToUniversalUnit(); |
cocorlow | 5:6fc37ae3f262 | 85 | Vector3 ToUniversal(); |
cocorlow | 5:6fc37ae3f262 | 86 | void CalcurateUnit(); |
cocorlow | 5:6fc37ae3f262 | 87 | void Calcurate(); |
cocorlow | 5:6fc37ae3f262 | 88 | Vector3 Calcurate(Vector3 position); |
cocorlow | 5:6fc37ae3f262 | 89 | }; |
cocorlow | 5:6fc37ae3f262 | 90 | |
cocorlow | 5:6fc37ae3f262 | 91 | extern Serial pc; |
cocorlow | 5:6fc37ae3f262 | 92 | |
cocorlow | 5:6fc37ae3f262 | 93 | #endif |