Skip to content

Commit

Permalink
add Sensor interface
Browse files Browse the repository at this point in the history
  • Loading branch information
soypat committed Sep 26, 2021
1 parent b35aab6 commit ba6bb82
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions sensor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package drivers

// Measurement specifies a type of measurement,
// for example: temperature, acceleration, pressure.
type Measurement uint32

// Sensor measurements
const (
Temperature Measurement = 1 << iota
Humidity
Pressure
Distance
Acceleration
AngularVelocity
MagneticField
Luminosity
Time
Audio
)

// Sensor represents an object capable of making one
// or more measurements. A sensor will then have methods
// which read the last updated measurements.
//
// Many Sensors may be collected into
// one Sensor interface to synchronize measurements.
type Sensor interface {
Update(which Measurement) error
}

0 comments on commit ba6bb82

Please sign in to comment.