Documentation ¶
Index ¶
- Constants
- func RelativeHeading(a *Accelerometer, m *Magnetometer) (float64, error)
- type Accelerometer
- func (a *Accelerometer) Read() (r3.Vector, error)
- func (a *Accelerometer) SetAntiAliasBandwidth(value uint16) error
- func (a *Accelerometer) SetFrequency(value float64) error
- func (a *Accelerometer) SetFullScale(value float64) error
- func (a *Accelerometer) Sleep() error
- func (a *Accelerometer) Wake() error
- type Magnetometer
Constants ¶
const DefaultAddress = 0x1d
DefaultAddress is a default I2C address for this sensor.
Variables ¶
This section is empty.
Functions ¶
func RelativeHeading ¶
func RelativeHeading(a *Accelerometer, m *Magnetometer) (float64, error)
RelativeHeading returns current heading, in radians. May only be used in relative computations.
Types ¶
type Accelerometer ¶
type Accelerometer struct {
// contains filtered or unexported fields
}
Accelerometer is a sensor driver implementation for LSM303D accelerometer. Documentation: http://goo.gl/qLMgFM Arduino code samples: https://github.com/pololu/lsm303-arduino
func NewAccelerometer ¶
func NewAccelerometer(bus i2c.Bus, addr byte) *Accelerometer
NewAccelerometer creates a new instance bound to I2C bus and address.
func (*Accelerometer) Read ¶
func (a *Accelerometer) Read() (r3.Vector, error)
Read reads acceleration vector, in g, from the accelerometer. Note: err might be a warning about data "freshness" if it's minimu9.DataAvailabilityError.
func (*Accelerometer) SetAntiAliasBandwidth ¶
func (a *Accelerometer) SetAntiAliasBandwidth(value uint16) error
SetAntiAliasBandwidth sets accelerometer's antialias filter bandwidth, in Hz. Supported values: 50, 194, 362, 773.
func (*Accelerometer) SetFrequency ¶
func (a *Accelerometer) SetFrequency(value float64) error
SetFrequency sets accelerometer output data rate, in Hz. Values: 3.125 .. 1600.
func (*Accelerometer) SetFullScale ¶
func (a *Accelerometer) SetFullScale(value float64) error
SetFullScale sets accelerometer scale, which affects sensitivity. Values: 2, 4, 6, 8, 16 (g)
func (*Accelerometer) Sleep ¶
func (a *Accelerometer) Sleep() error
Sleep puts accelerometer in power-down mode.
func (*Accelerometer) Wake ¶
func (a *Accelerometer) Wake() error
Wake returns accelerometer into operating mode.
type Magnetometer ¶
Magnetometer is a sensor driver implementation for LSM303D magnetometer. Documentation: http://goo.gl/qLMgFM Arduino code samples: https://github.com/pololu/lsm303-arduino
func NewMagnetometer ¶
func NewMagnetometer(bus i2c.Bus, addr byte) *Magnetometer
NewMagnetometer creates a new instance bound to I2C bus and address.
func (*Magnetometer) Calibrate ¶
func (m *Magnetometer) Calibrate(stop chan int) (r3.Vector, error)
Calibrate measures magnetometer bias until stop channel is written to. Calibration offset is then saved to the Offset field and the range is returned. NOTE: during calibration, rotate the sensor through all 3 axes.
func (*Magnetometer) Read ¶
func (m *Magnetometer) Read() (r3.Vector, error)
Read reads new data from the magnetometer. Note: err might be a warning about data "freshness" if it's minimu9.DataAvailabilityError.
func (*Magnetometer) SetFrequency ¶
func (m *Magnetometer) SetFrequency(value byte) error
SetFrequency sets magnetometer output data rate, in Hz. Values: 3, 6, 12, 25, 50, 100.
func (*Magnetometer) SetFullScale ¶
func (m *Magnetometer) SetFullScale(value float64) error
SetFullScale sets magnetometer scale that affects sensitivity. Values: 2, 4, 8, 12 (gauss).
func (*Magnetometer) Sleep ¶
func (m *Magnetometer) Sleep() error
Sleep puts magnetometer in power-down mode.
func (*Magnetometer) Wake ¶
func (m *Magnetometer) Wake() error
Wake returns magnetometer into operating mode.