GPS/GNSS UBX protocol test for UART
Dependencies: mbed LoopTicker GPSUBX_UART
Diff: main.cpp
- Revision:
- 1:97c5e20d51a9
- Parent:
- 0:27bfb46452f0
- Child:
- 3:3db7371d08f1
--- a/main.cpp Mon Sep 13 16:05:45 2021 +0000 +++ b/main.cpp Fri Sep 17 15:46:46 2021 +0000 @@ -1,15 +1,26 @@ #include "mbed.h" #include "GPSUBX_UART.hpp" +#include "LoopTicker.hpp" Serial pc(USBTX, USBRX, 115200); -//GPSUBX gps(PF_0, PF_1, 0x23, +9, 400000); -GPSUBX_UART gps(PD_1, PD_0, 38400, +9); +GPSUBX_UART gps(PD_1, PD_0); + +LoopTicker gps_ticker; + +void Display() +{ + pc.printf("POSLLH: %d, %f, %f, %f\r\n", gps.iTOW_POSLLH, gps.Longitude, gps.Latitude, gps.Height); + pc.printf("VELNED: %d, %f, %f, %f\r\n", gps.iTOW_VELNED, gps.VelocityNED.x, gps.VelocityNED.y, gps.VelocityNED.z); + pc.printf("TIMEUTC: %4d/%2d/%2d %2d:%2d %2d\r\n", gps.Year, gps.Month, gps.Day, gps.Hours, gps.Minutes, gps.Seconds); +} int main() { gps.Attach(); + gps_ticker.attach(&Display, 0.5); while (1) { -// gps.Receive(); + gps.Update(); + gps_ticker.loop(); } } \ No newline at end of file