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) ToF ¶
func (c Celsius) ToF() Fahrenheit
ToF returns the temperature as Fahrenheit, a unit used in the United States.
type Device ¶
type Device interface {
// 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.
It is expected to implement fmt.Stringer.
type Display ¶
type Display interface {
Device
// 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 {
Device
// 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].
type Milli ¶
type Milli int32
Milli is a fixed point value with 0.001 precision.
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.
|
Package ds248x controls a Maxim DS2483 or DS2482-100 1-wire interface chip over I²C. |
|
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.
|
Package cci declares the Camera Command Interface to interact with a FLIR Lepton over I²C. |
|
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. |