Documentation ¶
Index ¶
- Constants
- func HostInit() error
- type ADS
- func (ads *ADS) Close() error
- func (ads *ADS) Read() (uint16, error)
- func (ads *ADS) ReadBackground(result *uint16, sleepDuration time.Duration, stop chan struct{}, ...)
- func (ads *ADS) ReadRetry(maxRetries int) (result uint16, err error)
- func (ads *ADS) SetConfigDataRate(configDataRate ConfigDataRate)
- func (ads *ADS) SetConfigGain(configGain ConfigGain)
- func (ads *ADS) SetConfigInputMultiplexer(configInputMultiplexer ConfigInputMultiplexer)
- type ConfigDataRate
- type ConfigGain
- type ConfigInputMultiplexer
Constants ¶
const ( // ConfigInputMultiplexerDifferential01 000 : AINP = AIN0 and AINN = AIN1 (default) ConfigInputMultiplexerDifferential01 ConfigInputMultiplexer = 0x0000 // ConfigInputMultiplexerDifferential03 001 : AINP = AIN0 and AINN = AIN3 ConfigInputMultiplexerDifferential03 ConfigInputMultiplexer = 0x1000 // ConfigInputMultiplexerDifferential13 010 : AINP = AIN1 and AINN = AIN3 ConfigInputMultiplexerDifferential13 ConfigInputMultiplexer = 0x2000 // ConfigInputMultiplexerDifferential23 011 : AINP = AIN2 and AINN = AIN3 ConfigInputMultiplexerDifferential23 ConfigInputMultiplexer = 0x3000 // ConfigInputMultiplexerSingle0 100 : AINP = AIN0 and AINN = GND ConfigInputMultiplexerSingle0 ConfigInputMultiplexer = 0x4000 // ConfigInputMultiplexerSingle1 101 : AINP = AIN1 and AINN = GND ConfigInputMultiplexerSingle1 ConfigInputMultiplexer = 0x5000 // ConfigInputMultiplexerSingle2 110 : AINP = AIN2 and AINN = GND ConfigInputMultiplexerSingle2 ConfigInputMultiplexer = 0x6000 // ConfigInputMultiplexerSingle3 111 : AINP = AIN3 and AINN = GND ConfigInputMultiplexerSingle3 ConfigInputMultiplexer = 0x7000 // ConfigGain2_3 gain amplifier 2/3 is +/-6.144V range (default) ConfigGain2_3 ConfigGain = 0x0000 // 000 // ConfigGain1 gain amplifier 1 is +/-4.096V range ConfigGain1 ConfigGain = 0x0200 // 001 // ConfigGain2 gain amplifier 2 is +/-2.048V range ConfigGain2 ConfigGain = 0x0400 // 010 // ConfigGain4 gain amplifier 4 is +/-1.024V range ConfigGain4 ConfigGain = 0x0600 // 011 // ConfigGain8 gain amplifier 8 is +/-0.512V range ConfigGain8 ConfigGain = 0x0800 // 100 // ConfigGain16 gain amplifier 16 +/-0.256V range ConfigGain16 ConfigGain = 0x0A00 // 101 // ConfigDataRate8 data rate of 8 samples per second ConfigDataRate8 ConfigDataRate = 0x0000 // 000 // ConfigDataRate16 data rate of 16 samples per second ConfigDataRate16 ConfigDataRate = 0x0020 // 001 // ConfigDataRate32 data rate of 32 samples per second ConfigDataRate32 ConfigDataRate = 0x0040 // 010 // ConfigDataRate64 data rate of 64 samples per second ConfigDataRate64 ConfigDataRate = 0x0060 // 011 // ConfigDataRate128 data rate of 128 samples per second (default) ConfigDataRate128 ConfigDataRate = 0x0080 // 100 // ConfigDataRate250 data rate of 250 samples per second ConfigDataRate250 ConfigDataRate = 0x00A0 // 101 // ConfigDataRate475 data rate of 475 samples per second ConfigDataRate475 ConfigDataRate = 0x00C0 // 110 // ConfigDataRate860 data rate of 860 samples per second ConfigDataRate860 ConfigDataRate = 0x00E0 // 111 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ADS ¶
type ADS struct {
// contains filtered or unexported fields
}
ADS struct to interface with the Analog-to-Digital Converter. Call NewADS to create a new one.
func NewADS ¶
NewADS to create a new ADS struct. sensorType is not use at this time, it is for possible future use
func (*ADS) ReadBackground ¶
func (ads *ADS) ReadBackground(result *uint16, sleepDuration time.Duration, stop chan struct{}, stopped chan struct{})
ReadBackground it meant to be run in the background, run as a Goroutine. sleepDuration is how long it will try to sleep between reads. If there is ongoing read errors there will be no notice except that the result will not be updated. Will continue to read ads chip until stop is closed. After it has been stopped, the stopped chan will be closed. Will panic if result or stop are nil.
func (*ADS) ReadRetry ¶
ReadRetry will call Read until there is no errors or the maxRetries is hit. Suggest maxRetries to be set around 5.
func (*ADS) SetConfigDataRate ¶
func (ads *ADS) SetConfigDataRate(configDataRate ConfigDataRate)
SetConfigDataRate sets data rate
func (*ADS) SetConfigGain ¶
func (ads *ADS) SetConfigGain(configGain ConfigGain)
SetConfigGain sets gain
func (*ADS) SetConfigInputMultiplexer ¶
func (ads *ADS) SetConfigInputMultiplexer(configInputMultiplexer ConfigInputMultiplexer)
SetConfigInputMultiplexer sets input multiplexer
type ConfigInputMultiplexer ¶
type ConfigInputMultiplexer uint16
ConfigInputMultiplexer config input multiplexer