Skip to content

Commit

Permalink
Use RP2040 SerialUART instead of Arduino HardwareSerial to access set…
Browse files Browse the repository at this point in the history
…FIFOSize. Increase FIFO size to 256 byte reading entire NMEA sentences at once.
  • Loading branch information
Mictronics committed Jan 16, 2024
1 parent b3fe473 commit 766287d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/gps/GPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
#define GPS_RESET_MODE HIGH
#endif

#if defined(NRF52840_XXAA) || defined(NRF52833_XXAA) || defined(ARCH_ESP32) || defined(aLinuxInputImpl) || \
defined(RPI_PICO_WAVESHARE)
#if defined(NRF52840_XXAA) || defined(NRF52833_XXAA) || defined(ARCH_ESP32) || defined(aLinuxInputImpl)
HardwareSerial *GPS::_serial_gps = &Serial1;
#elif defined(RPI_PICO_WAVESHARE)
SerialUART *GPS::_serial_gps = &Serial1;
#else
HardwareSerial *GPS::_serial_gps = NULL;
#endif
Expand Down Expand Up @@ -1022,6 +1023,7 @@ GPS *GPS::createGps()
_serial_gps->begin(GPS_BAUDRATE, SERIAL_8N1, new_gps->rx_gpio, new_gps->tx_gpio);

#else
_serial_gps->setFIFOSize(256);
_serial_gps->begin(GPS_BAUDRATE);
#endif

Expand Down
5 changes: 4 additions & 1 deletion src/gps/GPS.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@ class GPS : private concurrency::OSThread

public:
/** If !NULL we will use this serial port to construct our GPS */
#if defined(RPI_PICO_WAVESHARE)
static SerialUART *_serial_gps;
#else
static HardwareSerial *_serial_gps;

#endif
static uint8_t _message_PMREQ[];
static const uint8_t _message_CFG_RXM_PSM[];
static const uint8_t _message_CFG_RXM_ECO[];
Expand Down

0 comments on commit 766287d

Please sign in to comment.