adafruit_gps

GPS parsing module. Can parse simple NMEA data sentences from serial GPS modules to read latitude, longitude, and more.

  • Author(s): Tony DiCola, James Carr

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_gps.GPS(uart: UART, debug: bool = False)[source]

GPS parsing module. Can parse simple NMEA data sentences from serial GPS modules to read latitude, longitude, and more.

property datetime: Optional[struct_time]

Return struct_time object to feed rtc.set_time_source() function

property has_3d_fix: bool

Returns true if there is a 3d fix available. use has_fix to determine if a 2d fix is available, passing it the same data

property has_fix: bool

True if a current fix for location information is available.

property in_waiting: int

Returns number of bytes available in UART read buffer

property nmea_sentence: Optional[str]

Return raw_sentence which is the raw NMEA sentence read from the GPS

read(num_bytes: Optional[int]) Optional[bytes][source]

Read up to num_bytes of data from the GPS directly, without parsing. Returns a bytestring with up to num_bytes or None if nothing was read

readline() Optional[bytes][source]

Returns a newline terminated bytestring, must have timeout set for the underlying UART or this will block forever!

send_command(command: bytes, add_checksum: bool = True) None[source]

Send a command string to the GPS. If add_checksum is True (the default) a NMEA checksum will automatically be computed and added. Note you should NOT add the leading $ and trailing * to the command as they will automatically be added!

update() bool[source]

Check for updated data from the GPS module and process it accordingly. Returns True if new data was processed, and False if nothing new was received.

write(bytestr: Union[array, bytearray, bytes, memoryview, rgbmatrix.RGBMatrix, ulab.numpy.ndarray]) Optional[int][source]

Write a bytestring data to the GPS directly, without parsing or checksums

class adafruit_gps.GPS_GtopI2C(i2c_bus: I2C, *, address: int = 16, debug: bool = False, timeout: float = 5.0)[source]

GTop-compatible I2C GPS parsing module. Can parse simple NMEA data sentences from an I2C-capable GPS module to read latitude, longitude, and more.

property in_waiting: Literal[16]

Returns number of bytes available in UART read buffer, always 16 since I2C does not have the ability to know how much data is available

read(num_bytes: int = 1) bytearray[source]

Read up to num_bytes of data from the GPS directly, without parsing. Returns a bytearray with up to num_bytes or None if nothing was read

readline() Optional[bytearray][source]

Returns a newline terminated bytearray, must have timeout set for the underlying UART or this will block forever!

write(bytestr: Union[array, bytearray, bytes, memoryview, rgbmatrix.RGBMatrix, ulab.numpy.ndarray]) None[source]

Write a bytestring data to the GPS directly, without parsing or checksums