hardware

package
v0.0.0-...-13dad8c Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BLACK = colorful.Color{R: 0.0, G: 0.0, B: 0.0}

BLACK is a pure blue integer representation

View Source
var BLUE = colorful.Color{R: 0.0, G: 0.0, B: 1.0}

BLUE is a pure blue integer representation

View Source
var GREEN = colorful.Color{R: 0.0, G: 1.0, B: 0.0}

GREEN is a pure green integer representation

View Source
var RED = colorful.Color{R: 1.0, G: 0.0, B: 0.0}

RED is a pure red integer representation

View Source
var StubI2CBus *stubembd.StubI2CBus

StubSPIBus can be set to a mock object for testing purposes

View Source
var StubSPIBus *stubembd.StubSPIBus

StubSPIBus can be set to a mock object for testing purposes

Functions

func Color

func Color(r, g, b int) colorful.Color

func ColorToPhilipsHueHSB

func ColorToPhilipsHueHSB(color colorful.Color) (uint16, uint8, uint8)

func Shutdown

func Shutdown()

Shutdown de-initializes the hardware, should be called when the service is shutting down

func Startup

func Startup()

Startup initializes the hardware, should be called before first access

Types

type ADC

type ADC interface {
	AnalogValueAt(chanNum int) (int, error)
}

ADC provdes an interface for communicating with an ADS1x15 analog to digital converter chip

func NewADS1115

func NewADS1115(bus embd.I2CBus) ADC

NewADS1115 creates an abstracted ADC based on the ADS1115 I2C chip

func NewMCP3008

func NewMCP3008(bus embd.SPIBus) ADC

NewADS1115 creates an abstracted ADC based on the MCP3008 SPI chip

type SoftwareSPI

type SoftwareSPI struct {
	// contains filtered or unexported fields
}

func NewSoftwareSPI

func NewSoftwareSPI(clk, mosi int) *SoftwareSPI

func (*SoftwareSPI) Close

func (o *SoftwareSPI) Close() error

Close releases the resources associated with the bus.

func (*SoftwareSPI) ReceiveByte

func (o *SoftwareSPI) ReceiveByte() (byte, error)

ReceiveByte receives a byte data.

func (*SoftwareSPI) ReceiveData

func (o *SoftwareSPI) ReceiveData(len int) ([]uint8, error)

ReceiveData receives data of length len into a slice.

func (*SoftwareSPI) TransferAndReceiveByte

func (o *SoftwareSPI) TransferAndReceiveByte(data byte) (byte, error)

TransferAndReceiveByte transmits a byte data and receives a byte.

func (*SoftwareSPI) TransferAndReceiveData

func (o *SoftwareSPI) TransferAndReceiveData(dataBuffer []uint8) error

TransferAndReceiveData transmits data in a buffer(slice) and receives into it.

func (*SoftwareSPI) Write

func (o *SoftwareSPI) Write(data []byte) (n int, err error)

type TemperatureReader

type TemperatureReader interface {
	// GetTemperatureReading reads the tempearature from the requested probe
	GetTemperatureReading(probe int32) (*models.TemperatureReading, error)
	// GetNumProbes returns the number of configured temperature probes
	GetNumProbes() int32
	// Close closes communication with the underlying hardware
	Close()
}

TemperatureReader provides an interface to read temperature values from the physical temperature probes

func NewTemperatureReader

func NewTemperatureReader() TemperatureReader

NewTemperatureReader provides an abstracted interface to the temperature probes

type WS2801

type WS2801 interface {
	GetPixels() []byte
	GetColors() ([]*colorful.Color, error)
	GetNumPixels() int32
	Close() error
	Off() error
	Update() error
	SetPixelRGB(n int32, r uint8, g uint8, b uint8) error
	SetPixelColor(n int32, color colorful.Color) error
	SetAllPixels(color colorful.Color) error
}

WS2801 privdes an interface for communicating with an LED strip which uses the WS2801 chip

func NewGrillLightController

func NewGrillLightController() WS2801

NewGrillLightController provides an abstracted interface to the LED strands

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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