ublox社製GPSモジュール NEO-7Mから、SPI経由でGPSデータをUBXプロトコルで読み出すライブラリです SPI経由ではGPSの出力設定が出来ないので、予めUART接続でPCから出力データを変更する必要があります。ここら辺の詳細については https://ameblo.jp/tsukuba-step/entry-12282936077.html を参考にして下さい。 出力設定は、 NAV-POSLLH,NAV-TIMEUTC,NAV-VELNED のみを出力して下さい
Revision 2:5992db47f3c3, committed 2018-02-13
- Comitter:
- kim1212
- Date:
- Tue Feb 13 04:52:01 2018 +0000
- Parent:
- 1:2457089ca195
- Commit message:
- ???
Changed in this revision
obsvdStruct.h | Show annotated file Show diff for this revision Revisions of this file |
ubloxUBX.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 2457089ca195 -r 5992db47f3c3 obsvdStruct.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/obsvdStruct.h Tue Feb 13 04:52:01 2018 +0000 @@ -0,0 +1,53 @@ +#ifndef OBSVDSTRUCT +#define OBSVDSTRUCT + +//全ての観測データを収納する型 +typedef struct obsvdData{ + + int Tim; + + int Lon; + int Lat; + int GHeight; //GPS高度 + + int VelN; + int VelE; + int VelD; + + int Acc[3]; + int Gyr[3]; + int Mag[3]; + + int PHeight; //気圧 + + +}obsvdData; + +typedef struct timData{ + int Year; + int Month; + int Day; + int Hour; + int Min; + int Sec; +}tim; + +typedef enum state{ + WAIT, + MANUAL, + AUTO, + READ, + STREAM, + CONFIG +}state; + +//ログの状態を表す +typedef enum logstate{ + STOP, + STBY, + RUNTIME, + FIN +}logstate; + + +#endif \ No newline at end of file
diff -r 2457089ca195 -r 5992db47f3c3 ubloxUBX.h --- a/ubloxUBX.h Tue Feb 13 04:25:54 2018 +0000 +++ b/ubloxUBX.h Tue Feb 13 04:52:01 2018 +0000 @@ -8,6 +8,38 @@ #define POSLLH_LEN 28 #define VELNED_LEN 36 +/* + +//sample program + +#include "mbed.h" +#include "ubloxUBX.h" + +GPS gps(PB_5,PB_4,PB_3,PB_6); +Serial pc(USBTX,USBRX); + + + +obsvdData obsvd; +tim gt; + + +int main() { + + while(1) { + while(gps.updateData()); //upload from ublox module + gps.chkData(&obsvd); //position and velocity data update + gps.chkTime(>); //time data update + + pc.printf("%d,%d,%d,%d\r\n",obsvd.Lon,obsvd.Lat,gt.Year,gt.Month); + wait(0.1); + } +} + + + +*/ + typedef union{ unsigned char Raw[TIMEUTC_LEN]; struct{