devices

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package devices contains interfaces for classes of devices.

Subpackages contain the concrete implementations. Devices accept port interface, constructors return concrete type.

Subpackage devicestest contains fake implementations for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Celsius

type Celsius Milli

Celsius is a temperature at a precision of 0.001°C.

Expected range is [-273150, >1000000]

func (Celsius) Float64

func (c Celsius) Float64() float64

Float64 returns the value as float64 with 0.001 precision.

func (Celsius) String

func (c Celsius) String() string

String returns the temperature formatted as a string.

func (Celsius) ToF

func (c Celsius) ToF() Fahrenheit

ToF returns the temperature as Fahrenheit, a unit used in the United States.

type Device deprecated

type Device interface {
	Halt() error
}

Device is a basic device.

Deprecated: This interface will be removed in v3. Use conn.Resource instead.

type Display

type Display interface {
	conn.Resource

	// Writer can be used when the native display pixel format is known. Each
	// write must cover exactly the whole screen as a single packed stream of
	// pixels.
	io.Writer
	// ColorModel returns the device native color model.
	//
	// It is generally color.NRGBA for a color display.
	ColorModel() color.Model
	// Bounds returns the size of the output device.
	//
	// Generally displays should have Min at {0, 0} but this is not guaranteed in
	// multiple displays setup or when an instance of this interface represents a
	// section of a larger logical display.
	Bounds() image.Rectangle
	// Draw updates the display with this image starting at 'sp' offset into the
	// display into 'r'. The code will likely be faster if the image is in the
	// display's native color format.
	//
	// To be compatible with draw.Drawer, this function doesn't return an error.
	Draw(r image.Rectangle, src image.Image, sp image.Point)
}

Display represents a pixel output device. It is a write-only interface.

What Display represents can be as varied as a 1 bit OLED display or a strip of LED lights.

type Environment

type Environment struct {
	Temperature Celsius
	Pressure    KPascal
	Humidity    RelativeHumidity
}

Environment represents measurements from an environmental sensor.

type Environmental

type Environmental interface {
	conn.Resource

	// Sense returns the value read from the sensor. Unsupported metrics are not
	// modified.
	Sense(env *Environment) error
	// SenseContinuous initiates a continuous sensing at the specified interval.
	//
	// It is important to call Halt() once done with the sensing, which will turn
	// the device off and will close the channel.
	SenseContinuous(interval time.Duration) (<-chan Environment, error)
}

Environmental represents an environmental sensor.

type Fahrenheit

type Fahrenheit Milli

Fahrenheit is an unsound unit used in the United States.

func (Fahrenheit) Float64

func (f Fahrenheit) Float64() float64

Float64 returns the value as float64 with 0.001 precision.

func (Fahrenheit) String

func (f Fahrenheit) String() string

String returns the temperature formatted as a string.

type KPascal

type KPascal Milli

KPascal is pressure at precision of 1Pa.

Expected range is [0, >1000000].

func (KPascal) Float64

func (k KPascal) Float64() float64

Float64 returns the value as float64 with 0.001 precision.

func (KPascal) String

func (k KPascal) String() string

String returns the pressure formatted as a string.

type Milli

type Milli int32

Milli is a fixed point value with 0.001 precision.

func (Milli) Float64

func (m Milli) Float64() float64

Float64 returns the value as float64 with 0.001 precision.

func (Milli) String

func (m Milli) String() string

String returns the value formatted as a string.

type RelativeHumidity

type RelativeHumidity int32

RelativeHumidity is humidity level in %rH with 0.01%rH precision.

func (RelativeHumidity) Float64

func (r RelativeHumidity) Float64() float64

Float64 returns the value in %.

func (RelativeHumidity) String

func (r RelativeHumidity) String() string

String returns the humidity formatted as a string.

Directories

Path Synopsis
Package apa102 drives a strip of APA102 LEDs connected on a SPI port.
Package apa102 drives a strip of APA102 LEDs connected on a SPI port.
Package bmxx80 controls a Bosch BMP180/BME280/BMP280 device over I²C, or SPI for the BMx280.
Package bmxx80 controls a Bosch BMP180/BME280/BMP280 device over I²C, or SPI for the BMx280.
bmx280smoketest
Package bmx280smoketest is leveraged by periph-smoketest to verify that two BME280/BMP280, one over I²C, one over SPI, read roughly the same temperature, humidity and pressure.
Package bmx280smoketest is leveraged by periph-smoketest to verify that two BME280/BMP280, one over I²C, one over SPI, read roughly the same temperature, humidity and pressure.
Package devicestest contains non-hardware devices implementations for testing or emulation purpose.
Package devicestest contains non-hardware devices implementations for testing or emulation purpose.
Package ds18b20 interfaces to Dallas Semi / Maxim DS18B20 and MAX31820 1-wire temperature sensors.
Package ds18b20 interfaces to Dallas Semi / Maxim DS18B20 and MAX31820 1-wire temperature sensors.
Package ds248x controls a Maxim DS2483 or DS2482-100 1-wire interface chip over I²C. Datasheets https://www.maximintegrated.com/en/products/digital/one-wire/DS2483.html https://www.maximintegrated.com/en/products/interface/controllers-expanders/DS2482-100.html
Package ds248x controls a Maxim DS2483 or DS2482-100 1-wire interface chip over I²C. Datasheets https://www.maximintegrated.com/en/products/digital/one-wire/DS2483.html https://www.maximintegrated.com/en/products/interface/controllers-expanders/DS2482-100.html
Package lepton drivers a FLIR Lepton.
Package lepton drivers a FLIR Lepton.
cci
Package cci declares the Camera Command Interface to interact with a FLIR Lepton over I²C. This protocol controls and queries the camera but is not used to read the images.
Package cci declares the Camera Command Interface to interact with a FLIR Lepton over I²C. This protocol controls and queries the camera but is not used to read the images.
Package lirc implements InfraRed receiver support through native linux app lirc.
Package lirc implements InfraRed receiver support through native linux app lirc.
Package ssd1306 controls a 128x64 monochrome OLED display via a SSD1306 controller.
Package ssd1306 controls a 128x64 monochrome OLED display via a SSD1306 controller.
image1bit
Package image1bit implements black and white (1 bit per pixel) 2D graphics.
Package image1bit implements black and white (1 bit per pixel) 2D graphics.
ssd1306smoketest
Package ssd1306smoketest is leveraged by periph-smoketest to verify that two SSD1306, one over I²C, one over SPI, can display the same output.
Package ssd1306smoketest is leveraged by periph-smoketest to verify that two SSD1306, one over I²C, one over SPI, can display the same output.
Package tm1637 controls a TM1637 device over GPIO pins.
Package tm1637 controls a TM1637 device over GPIO pins.

Jump to

Keyboard shortcuts

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