gps

package
v0.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2021 License: BSD-3-Clause Imports: 7 Imported by: 39

Documentation

Overview

Package gps provides a driver for GPS receivers over UART and I2C

Index

Constants

View Source
const (
	BYTES_AVAIL_REG = 0xfd
	DATA_STREAM_REG = 0xff
)
View Source
const (
	I2C_ADDRESS = 0x42
)

The I2C address which this device listens to.

Variables

This section is empty.

Functions

func FlightMode

func FlightMode(d Device) (err error)

func SetCfgGNSS

func SetCfgGNSS(d Device) (err error)

Types

type Device added in v0.14.0

type Device struct {
	// contains filtered or unexported fields
}

Device wraps a connection to a GPS device.

func NewI2C

func NewI2C(bus drivers.I2C) Device

NewI2C creates a new I2C GPS connection.

func NewUART

func NewUART(uart *machine.UART) Device

NewUART creates a new UART GPS connection. The UART must already be configured.

func (*Device) NextSentence added in v0.14.0

func (gps *Device) NextSentence() (sentence string, err error)

NextSentence returns the next valid NMEA sentence from the GPS device.

func (*Device) WriteBytes added in v0.14.0

func (gps *Device) WriteBytes(bytes []byte)

WriteBytes sends data/commands to the GPS device

type Fix

type Fix struct {
	// Valid if the fix was valid.
	Valid bool

	// Time that the fix was taken, in UTC time.
	Time time.Time

	// Latitude is the decimal latitude. Negative numbers indicate S.
	Latitude float32

	// Longitude is the decimal longitude. Negative numbers indicate E.
	Longitude float32

	// Altitude is only returned for GGA sentences.
	Altitude int32

	// Satellites is the number of visible satellites, but is only returned for GGA sentences.
	Satellites int16

	// Speed based on reported movement. Only returned for RMC sentences.
	Speed float32

	// Heading based on reported movement. Only returned for RMC sentences.
	Heading float32
}

Fix is a GPS location fix

type Parser

type Parser struct {
}

Parser for GPS NMEA sentences.

func NewParser added in v0.14.0

func NewParser() Parser

NewParser returns a GPS NMEA Parser.

func (*Parser) Parse added in v0.14.0

func (parser *Parser) Parse(sentence string) (fix Fix, err error)

Parse parses a NMEA sentence looking for fix info.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL