sensor

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BME280Sensor

type BME280Sensor struct {
	Driver  *i2c.BME280Driver
	Current Reading
	// contains filtered or unexported fields
}

BME280Sensor is a wrapper for the BME280 sensor drivers

func NewBME280Sensor

func NewBME280Sensor(adapter i2c.Connector, units string, tf, hf, pf float32) BME280Sensor

NewBME280Sensor returns a BME280Sensor

func (BME280Sensor) CleanUp

func (s BME280Sensor) CleanUp() error

func (BME280Sensor) Read

func (sensor BME280Sensor) Read(p []byte) (int, error)

Read gets the data from the sensor. It implements io.Reader by filling the []byte with the Reading struct encoded as JSON. Every successful call returns io.EOF.

func (BME280Sensor) Sample

func (sensor BME280Sensor) Sample() (float32, float32, float32, error)

type DummySensor

type DummySensor struct {
	Current Reading
	// contains filtered or unexported fields
}

DummySensor is a "wrapper" for a dummy sensor drivers

func NewDummySensor

func NewDummySensor(_ i2c.Connector, tf, hf, pf float32) DummySensor

NewDummySensor returns a DummySensor

func (DummySensor) CleanUp

func (s DummySensor) CleanUp() error

func (DummySensor) Read

func (sensor DummySensor) Read(p []byte) (int, error)

func (DummySensor) Sample

func (sensor DummySensor) Sample() (float32, float32, float32, error)

type Reading

type Reading struct {
	Temperature float32 `json:",omitempty"`
	Humidity    float32 `json:",omitempty"`
	Pressure    float32 `json:",omitempty"`
}

Reading holds air sensor readings Temperature is in C Humidity is % Pressure is in Pa

type SHT3xSensor

type SHT3xSensor struct {
	Driver  *i2c.SHT3xDriver
	Current Reading
	// contains filtered or unexported fields
}

SHT3xSensor is a wrapper for the SHT3x sensor drivers

func NewSHT3xSensor

func NewSHT3xSensor(adapter i2c.Connector, units string, tf, hf, pf float32) SHT3xSensor

NewSHT3xSensor returns a SHT3xSensor

func (SHT3xSensor) CleanUp

func (s SHT3xSensor) CleanUp() error

func (SHT3xSensor) Read

func (sensor SHT3xSensor) Read(p []byte) (int, error)

type Sensor

type Sensor interface {
	io.Reader
	CleanUp() error
}

func NewAirMeterReader

func NewAirMeterReader(adapter i2c.Connector, driver, units string, tf, hf, pf float32) (Sensor, error)

NewAirMeter returns the proper i2c airmeter driver

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL