$ show adafruit/Adafruit_GPS
This is the Adafruit GPS Library, an Arduino library for reading NMEA sentences from GPS/GNSS modules via UART, I2C, or SPI. It provides a high-level API (`Adafruit_GPS`) that exposes parsed position, time, speed, and other navigation data as simple member variables. The library also includes a newer, hardware-independent NMEA framing and decoding layer (`Adafruit_NMEA` and `Adafruit_GNSS`) that can be reused outside the Arduino context. Example sketches demonstrate wiring, parsing, LOCUS logging, and SD card data logging. The codebase is well-structured with clear separation between transport, framing, and position decoding. Extensive regression tests run on Linux using a mocking layer, with AddressSanitizer and UndefinedBehaviorSanitizer enabled. The architecture is a traditional Arduino library: users instantiate an `Adafruit_GPS` object with a `Stream` (hardware serial, software serial, I2C, or SPI), call `read()` frequently to consume bytes, then check `newNMEAreceived()` and call `parse()` to update fields. A newer `lastPosition()` getter provides exact coordinate components without modifying legacy state. The low-level `Adafruit_NMEA` class handles byte-by-byte framing with bounded buffers, checksum validation, and field iteration. `Adafruit_GNSS` adds static coordinate, time, and date parsing functions plus sentence validation for GGA, RMC, and GLL. Both classes are free of heap allocation and floating-point arithmetic where possible. The library is actively maintained with recent commits, a CI pipeline, and a single open issue. Technical drift is low: dependencies are limited to the Arduino core and standard libraries. The code demonstrates strong software engineering practices, including test-driven development, bounded buffers to prevent overflow, and a clean public API. The newer GNSS/NMEA components are reusable in other embedded or host projects with minimal adaptation.
The LLM identified 3 files worth highlighting for reuse:
Hardware-independent NMEA sentence framing, field iteration, and decimal parsing. Uses two caller-provided buffers for zero-copy reception. Validation checks format, checksum, and line endings without heap or floating point. The static `validate()`, `nextField()`, `parseDecimal()`, and `buildCommand()` functions can be reused in any NMEA parser or command generator, independent of the Adafruit_GPS class.
Transport-independent GNSS field decoders for GGA, RMC, and GLL sentences. Provides exact coordinate parsing with 9 fractional-minute digits, time/date parsing with validation, and a `lastPosition()` getter that returns independent position data without altering receiver state. The static `parseCoordinate()`, `formatCoordinate()`, `parseTime()`, and `parseDate()` functions are reusable wherever NMEA fields need exact conversion. Designed as a base class for receiver subclasses.
Minimal host-side Arduino compatibility layer for running library regression tests on Linux. Provides `Serial` output, `millis()`, `delay()`, and `yield()`, while stubbing hardware functions to abort on accidental access. Used by the CI test runner to compile and run tests with AddressSanitizer and UndefinedBehaviorSanitizer, ensuring parser correctness without connected hardware.