mirror of
https://github.com/kidoman/embd
synced 2025-07-03 03:47:33 +02:00
documentation changes
This commit is contained in:
parent
5c8ea918ab
commit
d171cfdc90
13 changed files with 177 additions and 33 deletions
|
@ -1,4 +1,4 @@
|
|||
// Package BH1750FVI allows interfacing with the BH1750FVI ambient light sensor through I2C protocol.
|
||||
// Package BH1750FVI allows interfacing with the BH1750FVI ambient light sensor through I2C.
|
||||
package bh1750fvi
|
||||
|
||||
import (
|
||||
|
@ -25,6 +25,7 @@ const (
|
|||
pollDelay = 150
|
||||
)
|
||||
|
||||
// BH1750FVI represents a BH1750FVI ambient light sensor.
|
||||
type BH1750FVI struct {
|
||||
Bus embd.I2CBus
|
||||
Poll int
|
||||
|
@ -38,6 +39,7 @@ type BH1750FVI struct {
|
|||
operationCode byte
|
||||
}
|
||||
|
||||
// New returns a BH1750FVI sensor at the specific resolution mode.
|
||||
func New(mode string, bus embd.I2CBus) *BH1750FVI {
|
||||
switch mode {
|
||||
case High:
|
||||
|
@ -49,12 +51,12 @@ func New(mode string, bus embd.I2CBus) *BH1750FVI {
|
|||
}
|
||||
}
|
||||
|
||||
// NewHighMode returns a BH1750FVI inteface on high resolution mode (1lx resolution)
|
||||
// NewHighMode returns a BH1750FVI sensor on high resolution mode (1lx resolution)
|
||||
func NewHighMode(bus embd.I2CBus) *BH1750FVI {
|
||||
return New(High, bus)
|
||||
}
|
||||
|
||||
// NewHighMode returns a BH1750FVI inteface on high resolution mode2 (0.5lx resolution)
|
||||
// NewHighMode returns a BH1750FVI sensor on high resolution mode2 (0.5lx resolution)
|
||||
func NewHigh2Mode(bus embd.I2CBus) *BH1750FVI {
|
||||
return New(High2, bus)
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ const (
|
|||
pollDelay = 250
|
||||
)
|
||||
|
||||
// BMP085 represents a Bosch BMP085 barometric sensor.
|
||||
type BMP085 struct {
|
||||
Bus embd.I2CBus
|
||||
Poll int
|
||||
|
@ -59,6 +60,7 @@ type BMP085 struct {
|
|||
quit chan struct{}
|
||||
}
|
||||
|
||||
// New returns a handle to a BMP085 sensor.
|
||||
func New(bus embd.I2CBus) *BMP085 {
|
||||
return &BMP085{Bus: bus, Poll: pollDelay}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ const (
|
|||
pollDelay = 250
|
||||
)
|
||||
|
||||
// BMP180 represents a Bosch BMP180 barometric sensor.
|
||||
type BMP180 struct {
|
||||
Bus embd.I2CBus
|
||||
Poll int
|
||||
|
@ -59,6 +60,7 @@ type BMP180 struct {
|
|||
quit chan struct{}
|
||||
}
|
||||
|
||||
// New returns a handle to a BMP180 sensor.
|
||||
func New(bus embd.I2CBus) *BMP180 {
|
||||
return &BMP180{Bus: bus, Poll: pollDelay}
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
// Package sensor contains the various sensors modules for use on your Raspberry Pi.
|
||||
// Package sensor contains the various sensors modules for use on your platform.
|
||||
package sensor
|
||||
|
|
|
@ -316,6 +316,7 @@ func (d *L3GD20) Temperature() (temp int, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
// Orientations returns a channel which will have the current temperature reading.
|
||||
func (d *L3GD20) Orientations() (orientations <-chan Orientation, err error) {
|
||||
if err = d.setup(); err != nil {
|
||||
return
|
||||
|
@ -366,6 +367,7 @@ func (d *L3GD20) Start() (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
// Stop the data acquisition loop.
|
||||
func (d *L3GD20) Stop() (err error) {
|
||||
if d.closing != nil {
|
||||
waitc := make(chan struct{})
|
||||
|
|
|
@ -42,6 +42,7 @@ const (
|
|||
pollDelay = 250
|
||||
)
|
||||
|
||||
// LSM303 represents a LSM303 magnetometer.
|
||||
type LSM303 struct {
|
||||
Bus embd.I2CBus
|
||||
Poll int
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"math"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/kidoman/embd"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Package watersensor allows interfacing with the water sensor
|
||||
// Package watersensor allows interfacing with the water sensor.
|
||||
package watersensor
|
||||
|
||||
import (
|
||||
|
@ -8,6 +8,7 @@ import (
|
|||
"github.com/kidoman/embd"
|
||||
)
|
||||
|
||||
// WaterSensor represents a water sensor.
|
||||
type WaterSensor struct {
|
||||
Pin embd.DigitalPin
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue