hmc5883l

package
v0.0.0-...-0d0e327 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package hmc5883l allows interfacing with the HMC5883L magnetometer.

Index

Constants

View Source
const (

	// ConfigA Params.
	MagHz75         = 0x00 // ODR = 0.75 Hz
	Mag1Hz5         = 0x04 // ODR = 1.5 Hz
	Mag3Hz          = 0x08 // ODR = 3 Hz
	Mag7Hz5         = 0x0C // ODR = 7.5 Hz
	Mag15Hz         = 0x10 // ODR = 15 Hz
	Mag30Hz         = 0x14 // ODR = 30 Hz
	Mag75Hz         = 0x18 // ODR = 75 Hz
	MagNormal       = 0x00 // Normal mode
	MagPositiveBias = 0x01 // Positive bias mode
	MagNegativeBias = 0x02 // Negative bias mode

	MagCRADefault = Mag15Hz | MagNormal // 15 Hz and normal mode is the default

	// ConfigB Params.
	MagCRBDefault = 0x20 // Gain 1090

	// Mode Reg Params.
	MagContinuous = 0x00 // Continuous conversion mode
	MagSingle     = 0x01 // Single conversion mode
	MagSleep      = 0x03 // Sleep mode

	MagMRDefault = MagContinuous // Continuous conversion is the default

)

Variables

This section is empty.

Functions

This section is empty.

Types

type HMC5883L

type HMC5883L struct {
	Bus  embd.I2CBus
	Poll int
	// contains filtered or unexported fields
}

HMC5883L represents a HMC5883L magnetometer.

func New

func New(bus embd.I2CBus) *HMC5883L

New creates a new HMC5883L interface. The bus variable controls the I2C bus used to communicate with the device.

func (*HMC5883L) Close

func (d *HMC5883L) Close() error

Close the sensor data acquisition loop and put the HMC5883L into sleep mode.

func (*HMC5883L) Heading

func (d *HMC5883L) Heading() (float64, error)

Heading returns the current heading [0, 360).

func (*HMC5883L) Run

func (d *HMC5883L) Run() error

Run starts the sensor data acquisition loop.

Jump to

Keyboard shortcuts

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