gps

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

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(gpsDevice GPSDevice) (err error)

func SetCfgGNSS

func SetCfgGNSS(gpsDevice GPSDevice) (err error)

Types

type Fix

type Fix struct {
	Valid      bool
	Time       time.Time
	Latitude   float32
	Longitude  float32
	Altitude   int32
	Satellites int16
}

fix is a GPS location fix

type GPSDevice

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

Device wraps a connection to a GPS device.

func NewI2C

func NewI2C(bus *machine.I2C) GPSDevice

NewI2C creates a new I2C GPS connection.

func NewUART

func NewUART(uart *machine.UART) GPSDevice

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

func (*GPSDevice) NextSentence

func (gps *GPSDevice) NextSentence() (sentence string)

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

func (*GPSDevice) WriteBytes

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

WriteBytes sends data/commands to the GPS device

type GPSParser

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

func Parser

func Parser(gpsDevice GPSDevice) GPSParser

func (*GPSParser) NextFix

func (parser *GPSParser) NextFix() (fix Fix)

NextFix returns the next GPS location Fix from the GPS device

Jump to

Keyboard shortcuts

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