I2C device library collection for AVR/Arduino or other C++-based MCUs
Default constructor, uses default I2C address.
Specific address constructor.
Get comparator latch enabled value.
Get comparator mode.
Get comparator polarity setting.
Get comparator queue mode.
Get AIN0/GND differential. This changes the MUX setting to AIN0/GND if necessary, triggers a new measurement (also only if necessary), then gets the differential value currently in the CONVERSION register.
Get AIN1/GND differential. This changes the MUX setting to AIN1/GND if necessary, triggers a new measurement (also only if necessary), then gets the differential value currently in the CONVERSION register.
Get AIN2/GND differential. This changes the MUX setting to AIN2/GND if necessary, triggers a new measurement (also only if necessary), then gets the differential value currently in the CONVERSION register.
Get AIN3/GND differential. This changes the MUX setting to AIN3/GND if necessary, triggers a new measurement (also only if necessary), then gets the differential value currently in the CONVERSION register.
Read differential value based on current MUX configuration. The default MUX setting sets the device to get the differential between the AIN0 and AIN1 pins. There are 8 possible MUX settings, but if you are using all four input pins as single-end voltage sensors, then the default option is not what you want; instead you will need to set the MUX to compare the desired AIN* pin with GND. There are four shortcut methods (getDiff*) to do this conveniently, but you can also do it manually with setMultiplexer() followed by this method.
In single-shot mode, this register may not have fresh data. You need to write a 1 bit to the MSB of the CONFIG register to trigger a single read/conversion before this will be populated with fresh data. This technique is not as effortless, but it has enormous potential to save power by only running the comparison circuitry when needed.
Get AIN0/N1 differential. This changes the MUX setting to AIN0/N1 if necessary, triggers a new measurement (also only if necessary), then gets the differential value currently in the CONVERSION register.
Get AIN0/N3 differential. This changes the MUX setting to AIN0/N1 if necessary, triggers a new measurement (also only if necessary), then gets the differential value currently in the CONVERSION register.
Get AIN1/N3 differential. This changes the MUX setting to AIN1/N3 if necessary, triggers a new measurement (also only if necessary), then gets the differential value currently in the CONVERSION register.
Get AIN2/N3 differential. This changes the MUX setting to AIN2/N3 if necessary, triggers a new measurement (also only if necessary), then gets the differential value currently in the CONVERSION register.
Get programmable gain amplifier level.
Get high threshold value.
Get low threshold value.
Get the current voltage reading Read the current differential and return it multiplied by the constant for the current gain. mV is returned to increase the precision of the voltage
Get device mode.
Get multiplexer connection.
Return the current multiplier for the PGA setting.
This may be directly retreived by using getMilliVolts(), but this causes an independent read. This function could be used to average a number of reads from the getDifferential() or getDiffx(), or getDifferentialx() functions and cut down on the number of floating-point calculations needed.
Get operational status.
Get data rate.
Power on and prepare for general usage. This device is ready to use automatically upon power-up. It defaults to single-shot read mode, P0/N1 mux, 2.048v gain, 128 samples/sec, default comparator with hysterysis, active-low polarity, non-latching comparator, and comparater-disabled operation. This stub function is present for device library consistency.
Set comparator latch enabled value.
Set comparator mode.
Set comparator polarity setting.
Set comparator queue mode.
Set programmable gain amplifier level.
Set high threshold value.
Set low threshold value.
Set device mode.
Set multiplexer connection.
Set operational status. This bit can only be written while in power-down mode (no conversions active).
Set data rate.
Verify the I2C connection. Make sure the device is connected and responds as expected.