Documentation ¶
Overview ¶
Package mcp3008helper is shared code for hooking an MCP3008 ADC up to a board. It is used in both the pi and genericlinux board implementations, but does not implement a board directly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MCP3008AnalogConfig ¶
type MCP3008AnalogConfig struct { Name string `json:"name"` Pin string `json:"pin"` // analog input pin on the ADC itself SPIBus string `json:"spi_bus"` // name of the SPI bus (which is configured elsewhere in the config file) ChipSelect string `json:"chip_select"` // the CS line for the ADC chip, typically a pin number on the board AverageOverMillis int `json:"average_over_ms,omitempty"` SamplesPerSecond int `json:"samples_per_sec,omitempty"` }
MCP3008AnalogConfig describes the configuration of a MCP3008 analog reader on a board.
func (*MCP3008AnalogConfig) Validate ¶
func (config *MCP3008AnalogConfig) Validate(path string) error
Validate ensures all parts of the config are valid.
type MCP3008AnalogReader ¶
MCP3008AnalogReader implements a board.AnalogReader using an MCP3008 ADC via SPI.
func (*MCP3008AnalogReader) Close ¶
func (mar *MCP3008AnalogReader) Close(ctx context.Context) error
Close does nothing.
func (*MCP3008AnalogReader) Read ¶
func (mar *MCP3008AnalogReader) Read(ctx context.Context, extra map[string]interface{}) ( analogVal board.AnalogValue, err error, )
Read returns a board.AnalogValue, but the Min, Max, and StepSize within it are never initialized and will always be 0!
Click to show internal directories.
Click to hide internal directories.