mirror of
https://github.com/kidoman/embd
synced 2025-07-04 20:37:46 +02:00
bring in the idea of a hardware abstraction layer
This commit is contained in:
parent
b4de382833
commit
b5e2d0acc7
35 changed files with 994 additions and 971 deletions
|
@ -76,9 +76,6 @@ type bmp180 struct {
|
|||
debug bool
|
||||
}
|
||||
|
||||
// Default instance of the BMP180 sensor.
|
||||
var Default = New(i2c.Default)
|
||||
|
||||
// New creates a new BMP180 interface. The bus variable controls
|
||||
// the I2C bus used to communicate with the device.
|
||||
func New(bus i2c.Bus) BMP180 {
|
||||
|
@ -440,33 +437,3 @@ func (d *bmp180) Close() {
|
|||
d.quit <- struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
// SetPollDelay sets the delay between runs of the data acquisition loop.
|
||||
func SetPollDelay(delay int) {
|
||||
Default.SetPollDelay(delay)
|
||||
}
|
||||
|
||||
// Temperature returns the current temperature reading.
|
||||
func Temperature() (temp float64, err error) {
|
||||
return Default.Temperature()
|
||||
}
|
||||
|
||||
// Pressure returns the current pressure reading.
|
||||
func Pressure() (pressure int, err error) {
|
||||
return Default.Pressure()
|
||||
}
|
||||
|
||||
// Altitude returns the current altitude reading.
|
||||
func Altitude() (altitude float64, err error) {
|
||||
return Default.Altitude()
|
||||
}
|
||||
|
||||
// Run starts the sensor data acquisition loop.
|
||||
func Run() (err error) {
|
||||
return Default.Run()
|
||||
}
|
||||
|
||||
// Close.
|
||||
func Close() {
|
||||
Default.Close()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue