GPS/GNSS UBX library for UART
Dependencies: Vector3
Diff: GPSUBX_UART.hpp
- Revision:
- 1:71f5168e48c8
- Parent:
- 0:cf7c726ec8a1
- Child:
- 2:6218fe8e54f4
diff -r cf7c726ec8a1 -r 71f5168e48c8 GPSUBX_UART.hpp --- a/GPSUBX_UART.hpp Mon Sep 13 16:04:40 2021 +0000 +++ b/GPSUBX_UART.hpp Fri Sep 17 15:06:47 2021 +0000 @@ -12,7 +12,7 @@ #define UBX_SYNC 0x62 << 8 | 0xb5 -#define RECEIVE_SIZE 512 +#define RECEIVE_SIZE 1024 #define SENTENCE_SIZE 64 extern Serial pc; @@ -107,15 +107,15 @@ class GPSUBX_UART { private: - Serial serial; + RawSerial serial; char receive_buffer[RECEIVE_SIZE]; char sentence_buffer[SENTENCE_SIZE]; static const float Radius = 6378136.6f; - void Punctuate(); + void Receive(); + void Decode(char buffer[], int mc, int mi); public: - int TimeZone; int Year; int Month; int Day; @@ -131,6 +131,9 @@ float GroundSpeed; float Heading; int iTOW_VELNED; + + int TimeZone; + volatile int receive_index; Vector3 UniversalZeroPosition; Vector3 UniversalZeroUnitN; @@ -139,10 +142,9 @@ Vector3 UniversalPosition; Vector3 PositionNED; - GPSUBX_UART(PinName tx, PinName rx, int baud, int timezone); - void Receive(); + GPSUBX_UART(PinName tx, PinName rx, int baud = 38400, int timezone = 9); + void Update(); void Attach(); - void Decode(char buffer[], int mc, int mi); // Position Calculation Vector3 ToUniversalUnit();