sensors

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package sensors exposes sensor data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ADC101x

type ADC101x struct {
	Count   int     `json:"adc"`
	Voltage float64 `json:"voltage"`
}

type At30tse75x

type At30tse75x struct {
	Temp float64 `json:"temp"`
}

type Bme280

type Bme280 struct {
	Temp float64 `json:"temp"`
	Hum  float64 `json:"humi"`
	Pres float64 `json:"pres"`
}

type Data

type Data struct {
	Name  string  `json:"name"`
	Type  Type    `json:"type"`
	Value float64 `json:"value"`
}

type Descr

type Descr interface {
	Descr() *DescrBase
	// contains filtered or unexported methods
}

type DescrADC101x

type DescrADC101x struct {
	Base DescrBase
	Vdd  float64

	FullRange int
}

func (*DescrADC101x) Descr

func (d *DescrADC101x) Descr() *DescrBase

func (*DescrADC101x) UnmarshalXML

func (d *DescrADC101x) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error

type DescrAT30TSE

type DescrAT30TSE struct{ DescrBase }

type DescrBME280

type DescrBME280 struct{ DescrBase }

type DescrBase

type DescrBase struct {
	Name    string
	ChanID  int
	Type    string
	I2CAddr uint8
}

func (*DescrBase) Descr

func (d *DescrBase) Descr() *DescrBase

func (*DescrBase) UnmarshalXML

func (d *DescrBase) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error

type DescrHTS221

type DescrHTS221 struct{ DescrBase }

type DescrOnBoard

type DescrOnBoard struct{ DescrBase }

type Hts221

type Hts221 struct {
	Temp float64 `json:"temp"`
	Humi float64 `json:"humi"`
}

type Sensors

type Sensors struct {
	Timestamp time.Time         `json:"timestamp"`
	Sensors   []Data            `json:"sensors"`
	Labels    map[string][]Type `json:"labels"`
}

func New

func New(bus *smbus.Conn, addr uint8, descr []Descr) (Sensors, error)

type Table

type Table []Sensors

func (Table) Data

func (tbl Table) Data(typ Type, label string) (float64, float64, plotter.XYs)

func (Table) Labels

func (tbl Table) Labels(typ Type) []string

type Tsl2591

type Tsl2591 struct {
	Lux  float64 `json:"lux"`
	Full uint16  `json:"full"`
	IR   uint16  `json:"ir"`
}

type Type

type Type uint8

Type describes the type of data sensor (H,P,T,L,V)

const (
	InvalidType Type = iota
	Humidity
	Pressure
	Temperature
	Luminosity
	Voltage
)

func (Type) MarshalJSON

func (t Type) MarshalJSON() ([]byte, error)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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