Documentation ¶
Overview ¶
Package analog defines analog pins, both digital to analog converter (DAC) and analog to digital converter (ADC).
Index ¶
Constants ¶
View Source
const ( // ADC means Analog-to-Digital Converter. ADC pin.Func = "ADC" // DAC means Digital-to-Analog Converter. DAC pin.Func = "DAC" )
Well known pin functionality.
Variables ¶
View Source
var INVALID invalidPin
INVALID implements both PinADC and PinDAC and fails on all access.
Functions ¶
This section is empty.
Types ¶
type PinADC ¶
type PinADC interface { pin.Pin // Range returns the maximum supported range [min, max] of the values. // // It is possible for a DAC that the Sample.V value is not set. Range() (Sample, Sample) // Read returns the current pin level. Read() (Sample, error) }
PinADC is an analog-to-digital-conversion input.
type PinDAC ¶
type PinDAC interface { pin.Pin // Range returns the maximum supported range [min, max] of the values. // // It is possible for a DAC that the Sample.V value is not set. Range() (Sample, Sample) // Out sets an analog output value. Out(v int32) error }
PinDAC is an digital-to-analog-conversion output.
type Sample ¶
type Sample struct { // V is the interpreted electrical tension. V physic.ElectricPotential // Raw is the raw measurement. Raw int32 }
Sample is one analog sample.
Raw must be set, but V may or may not be set, depending if the device knows the electrical tension this measurement represents.
Click to show internal directories.
Click to hide internal directories.