325 uint16_t sample()
Return most-recent (unscaled) sample value from moving average array.
Definition: i2c_adc_ads7828.cpp:170
static const uint8_t REFERENCE_ON
Configure channels to turn internal reference ON between conversions (Command byte PD1=1)...
Definition: i2c_adc_ads7828.h:143
uint8_t commandByte()
Return command byte for channel object.
Definition: i2c_adc_ads7828.cpp:55
static const uint8_t MOVING_AVERAGE_BITS_
Quantity of samples to be averaged = 2MOVING_AVERAGE_BITS_.
Definition: i2c_adc_ads7828.h:264
static const uint8_t SINGLE_ENDED
Configure channels to use single-ended inputs (Command byte SD=1).
Definition: i2c_adc_ads7828.h:115
void reset()
Reset moving average array, index, totalizer to zero.
Definition: i2c_adc_ads7828.cpp:149
static const uint16_t DEFAULT_MAX_SCALE
Default scaling maximum value used in ADS7828 constructor.
Definition: i2c_adc_ads7828.h:186
static const uint16_t DEFAULT_MIN_SCALE
Default scaling minimum value used in ADS7828 constructor.
Definition: i2c_adc_ads7828.h:181
uint8_t address_
Device address as defined by pins A1, A0.
Definition: i2c_adc_ads7828.h:309
static const uint8_t DIFFERENTIAL
Configure channels to use differential inputs (Command byte SD=0).
Definition: i2c_adc_ads7828.h:101
ADS7828 * device()
Return pointer to parent device object.
Definition: i2c_adc_ads7828.cpp:71
static const uint8_t REFERENCE_OFF
Configure channels to turn internal reference OFF between conversions (Command byte PD1=0)...
Definition: i2c_adc_ads7828.h:129
static const uint8_t ADC_OFF
Configure channels to turn A/D converter OFF between conversions (Command byte PD0=0).
Definition: i2c_adc_ads7828.h:157
Definition: i2c_adc_ads7828.h:191
uint16_t total_
(Unscaled) running total of moving average array elements.
Definition: i2c_adc_ads7828.h:258
uint8_t update()
Initiate A/D conversion, read data, update moving average for channel object.
Definition: i2c_adc_ads7828.cpp:231
ADS7828 * device_
Pointer to parent device object.
Definition: i2c_adc_ads7828.h:248
uint8_t index()
Return index position within moving average array.
Definition: i2c_adc_ads7828.cpp:120
uint8_t commandByte_
Command byte for device object (PD1 PD0 bits only).
Definition: i2c_adc_ads7828.h:315
uint16_t samples_[1<< 4]
Array of (unscaled) sample values.
Definition: i2c_adc_ads7828.h:255
void newSample(uint16_t)
Add (unscaled) sample value to moving average array, update totalizer.
Definition: i2c_adc_ads7828.cpp:130
Definition: i2c_adc_ads7828.h:268
uint16_t minScale
Minimum value of moving average (defaults to 0x0000).
Definition: i2c_adc_ads7828.h:234
static const uint8_t DEFAULT_CHANNEL_MASK
Default channel mask used in ADS7828 constructor.
Definition: i2c_adc_ads7828.h:176
uint8_t index_
Index position within moving average array.
Definition: i2c_adc_ads7828.h:251
uint8_t id()
Return ID number of channel object (+IN connection).
Definition: i2c_adc_ads7828.cpp:102
uint8_t start()
Initiate A/D conversion for channel object.
Definition: i2c_adc_ads7828.cpp:192
uint16_t total()
Return (unscaled) totalizer value for channel object.
Definition: i2c_adc_ads7828.cpp:209
static const uint8_t ADC_ON
Configure channels to turn A/D converter ON between conversions (Command byte PD0=1).
Definition: i2c_adc_ads7828.h:171
uint8_t commandByte_
Command byte for channel object (SD C2 C1 C0 bits only).
Definition: i2c_adc_ads7828.h:245
uint8_t channelMask
Each bit position containing a 1 represents a channel that is to be read via update() / updateAll()...
Definition: i2c_adc_ads7828.h:292
uint16_t maxScale
Maximum value of moving average (defaults to 0x0FFF).
Definition: i2c_adc_ads7828.h:222
uint16_t value()
Return moving average value for channel object.
Definition: i2c_adc_ads7828.cpp:248