1
0
Fork 0
mirror of https://github.com/kidoman/embd synced 2025-07-03 11:57:38 +02:00

bring in the idea of a hardware abstraction layer

This commit is contained in:
Karan Misra 2014-02-27 04:24:53 +05:30
parent b4de382833
commit b5e2d0acc7
35 changed files with 994 additions and 971 deletions

View file

@ -70,9 +70,6 @@ type lsm303 struct {
debug bool
}
// Default instance of the LSM303 sensor.
var Default = New(i2c.Default)
// New creates a new LSM303 interface. The bus variable controls
// the I2C bus used to communicate with the device.
func New(bus i2c.Bus) LSM303 {
@ -185,23 +182,3 @@ func (d *lsm303) Close() (err error) {
err = d.bus.WriteByteToReg(magAddress, magModeReg, MagSleep)
return
}
// SetPollDelay sets the delay between runs of the data acquisition loop.
func SetPollDelay(delay int) {
Default.SetPollDelay(delay)
}
// Heading returns the current heading [0, 360).
func Heading() (heading float64, err error) {
return Default.Heading()
}
// Run starts the sensor data acquisition loop.
func Run() (err error) {
return Default.Run()
}
// Close closes the sensor data acquisition loop and put the LSM303 into sleep mode.
func Close() (err error) {
return Default.Close()
}