devices

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package devices contains interfaces for classes of devices.

Subpackages contain the concrete implementations. Devices accept bus 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

type Device interface {
	fmt.Stringer
	// Halt stops the device.
	//
	// Unlike a connection, a device cannot be closed, only the port can be
	// closed. On the other hand, a device can be halted. What halting entails
	// depends on the actual device but it should stop motion, sensing or light
	// emission.
	Halt() error
}

Device is a basic device.

type Display

type Display interface {
	// 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 {
	// Sense returns the value read from the sensor. Unsupported metrics are not
	// modified.
	Sense(env *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 bme280 controls a Bosch BME280 device over I²C. Datasheet https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BME280_DS001-11.pdf
Package bme280 controls a Bosch BME280 device over I²C. Datasheet https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BME280_DS001-11.pdf
bme280smoketest
Package bme280smoketest is leveraged by periph-smoketest to verify that two BME280, one over I²C, one over SPI, read roughly the same temperature, humidity and pressure.
Package bme280smoketest is leveraged by periph-smoketest to verify that two BME280, 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