Constructor & Destructor Documentation
Default constructor, uses default I2C address.
- See also:
- ADS1115_DEFAULT_ADDRESS
ADS1115::ADS1115 |
( |
uint8_t |
address | ) |
|
Specific address constructor.
- Parameters:
-
- See also:
- ADS1115_DEFAULT_ADDRESS
-
ADS1115_ADDRESS_ADDR_GND
-
ADS1115_ADDRESS_ADDR_VDD
-
ADS1115_ADDRESS_ADDR_SDA
-
ADS1115_ADDRESS_ADDR_SDL
Member Function Documentation
bool ADS1115::getComparatorLatchEnabled |
( |
| ) |
|
Get comparator latch enabled value.
- Returns:
- Current comparator latch enabled value
- See also:
- ADS1115_COMP_LAT_NON_LATCHING
-
ADS1115_COMP_LAT_LATCHING
-
ADS1115_RA_CONFIG
-
ADS1115_CFG_COMP_LAT_BIT
uint8_t ADS1115::getComparatorMode |
( |
| ) |
|
Get comparator mode.
- Returns:
- Current comparator mode
- See also:
- ADS1115_COMP_MODE_HYSTERESIS
-
ADS1115_COMP_MODE_WINDOW
-
ADS1115_RA_CONFIG
-
ADS1115_CFG_COMP_MODE_BIT
uint8_t ADS1115::getComparatorPolarity |
( |
| ) |
|
Get comparator polarity setting.
- Returns:
- Current comparator polarity setting
- See also:
- ADS1115_COMP_POL_ACTIVE_LOW
-
ADS1115_COMP_POL_ACTIVE_HIGH
-
ADS1115_RA_CONFIG
-
ADS1115_CFG_COMP_POL_BIT
uint8_t ADS1115::getComparatorQueueMode |
( |
| ) |
|
Get comparator queue mode.
- Returns:
- Current comparator queue mode
- See also:
- ADS1115_COMP_QUE_ASSERT1
-
ADS1115_COMP_QUE_ASSERT2
-
ADS1115_COMP_QUE_ASSERT4
-
ADS1115_COMP_QUE_DISABLE
-
ADS1115_RA_CONFIG
-
ADS1115_CFG_COMP_QUE_BIT
-
ADS1115_CFG_COMP_QUE_LENGTH
int16_t ADS1115::getDiff0 |
( |
| ) |
|
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.
- Returns:
- 16-bit signed differential value
- See also:
- getDifferential()
int16_t ADS1115::getDiff1 |
( |
| ) |
|
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.
- Returns:
- 16-bit signed differential value
- See also:
- getDifferential()
int16_t ADS1115::getDiff2 |
( |
| ) |
|
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.
- Returns:
- 16-bit signed differential value
- See also:
- getDifferential()
int16_t ADS1115::getDiff3 |
( |
| ) |
|
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.
- Returns:
- 16-bit signed differential value
- See also:
- getDifferential()
int16_t ADS1115::getDifferential |
( |
| ) |
|
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.
- Returns:
- 16-bit signed differential value
- See also:
- getDifferential0();
-
getDifferential1();
-
getDifferential2();
-
getDifferential3();
-
getDiff0();
-
getDiff1();
-
getDiff2();
-
getDiff3();
-
setMultiplexer();
-
ADS1115_RA_CONVERSION
-
ADS1115_MUX_P0_N1
-
ADS1115_MUX_P0_N3
-
ADS1115_MUX_P1_N3
-
ADS1115_MUX_P2_N3
-
ADS1115_MUX_P0_NG
-
ADS1115_MUX_P1_NG
-
ADS1115_MUX_P2_NG
-
ADS1115_MUX_P3_NG
int16_t ADS1115::getDifferential0 |
( |
| ) |
|
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.
- Returns:
- 16-bit signed differential value
- See also:
- getDifferential()
int16_t ADS1115::getDifferential1 |
( |
| ) |
|
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.
- Returns:
- 16-bit signed differential value
- See also:
- getDifferential()
int16_t ADS1115::getDifferential2 |
( |
| ) |
|
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.
- Returns:
- 16-bit signed differential value
- See also:
- getDifferential()
int16_t ADS1115::getDifferential3 |
( |
| ) |
|
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.
- Returns:
- 16-bit signed differential value
- See also:
- getDifferential()
uint8_t ADS1115::getGain |
( |
| ) |
|
Get programmable gain amplifier level.
- Returns:
- Current programmable gain amplifier level
- See also:
- ADS1115_RA_CONFIG
-
ADS1115_CFG_PGA_BIT
-
ADS1115_CFG_PGA_LENGTH
int16_t ADS1115::getHighThreshold |
( |
| ) |
|
Get high threshold value.
- Returns:
- Current high threshold value
- See also:
- ADS1115_RA_HI_THRESH
int16_t ADS1115::getLowThreshold |
( |
| ) |
|
Get low threshold value.
- Returns:
- Current low threshold value
- See also:
- ADS1115_RA_LO_THRESH
float ADS1115::getMilliVolts |
( |
| ) |
|
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
uint8_t ADS1115::getMode |
( |
| ) |
|
Get device mode.
- Returns:
- Current device mode
- See also:
- ADS1115_MODE_CONTINUOUS
-
ADS1115_MODE_SINGLESHOT
-
ADS1115_RA_CONFIG
-
ADS1115_CFG_MODE_BIT
uint8_t ADS1115::getMultiplexer |
( |
| ) |
|
Get multiplexer connection.
- Returns:
- Current multiplexer connection setting
- See also:
- ADS1115_RA_CONFIG
-
ADS1115_CFG_MUX_BIT
-
ADS1115_CFG_MUX_LENGTH
float ADS1115::getMvPerCount |
( |
| ) |
|
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.
uint8_t ADS1115::getOpStatus |
( |
| ) |
|
Get operational status.
- Returns:
- Current operational status (0 for active conversion, 1 for inactive)
- See also:
- ADS1115_OS_ACTIVE
-
ADS1115_OS_INACTIVE
-
ADS1115_RA_CONFIG
-
ADS1115_CFG_OS_BIT
uint8_t ADS1115::getRate |
( |
| ) |
|
Get data rate.
- Returns:
- Current data rate
- See also:
- ADS1115_RA_CONFIG
-
ADS1115_CFG_DR_BIT
-
ADS1115_CFG_DR_LENGTH
void ADS1115::initialize |
( |
| ) |
|
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.
void ADS1115::setComparatorLatchEnabled |
( |
bool |
enabled | ) |
|
Set comparator latch enabled value.
- Parameters:
-
enabled | New comparator latch enabled value |
- See also:
- ADS1115_COMP_LAT_NON_LATCHING
-
ADS1115_COMP_LAT_LATCHING
-
ADS1115_RA_CONFIG
-
ADS1115_CFG_COMP_LAT_BIT
void ADS1115::setComparatorMode |
( |
uint8_t |
mode | ) |
|
Set comparator mode.
- Parameters:
-
- See also:
- ADS1115_COMP_MODE_HYSTERESIS
-
ADS1115_COMP_MODE_WINDOW
-
ADS1115_RA_CONFIG
-
ADS1115_CFG_COMP_MODE_BIT
void ADS1115::setComparatorPolarity |
( |
uint8_t |
polarity | ) |
|
Set comparator polarity setting.
- Parameters:
-
polarity | New comparator polarity setting |
- See also:
- ADS1115_COMP_POL_ACTIVE_LOW
-
ADS1115_COMP_POL_ACTIVE_HIGH
-
ADS1115_RA_CONFIG
-
ADS1115_CFG_COMP_POL_BIT
void ADS1115::setComparatorQueueMode |
( |
uint8_t |
mode | ) |
|
Set comparator queue mode.
- Parameters:
-
mode | New comparator queue mode |
- See also:
- ADS1115_COMP_QUE_ASSERT1
-
ADS1115_COMP_QUE_ASSERT2
-
ADS1115_COMP_QUE_ASSERT4
-
ADS1115_COMP_QUE_DISABLE
-
ADS1115_RA_CONFIG
-
ADS1115_CFG_COMP_QUE_BIT
-
ADS1115_CFG_COMP_QUE_LENGTH
void ADS1115::setGain |
( |
uint8_t |
gain | ) |
|
Set programmable gain amplifier level.
- Parameters:
-
gain | New programmable gain amplifier level |
- See also:
- ADS1115_PGA_6P144
-
ADS1115_PGA_4P096
-
ADS1115_PGA_2P048
-
ADS1115_PGA_1P024
-
ADS1115_PGA_0P512
-
ADS1115_PGA_0P256
-
ADS1115_RA_CONFIG
-
ADS1115_CFG_PGA_BIT
-
ADS1115_CFG_PGA_LENGTH
void ADS1115::setHighThreshold |
( |
int16_t |
threshold | ) |
|
Set high threshold value.
- Parameters:
-
threshold | New high threshold value |
- See also:
- ADS1115_RA_HI_THRESH
void ADS1115::setLowThreshold |
( |
int16_t |
threshold | ) |
|
Set low threshold value.
- Parameters:
-
threshold | New low threshold value |
- See also:
- ADS1115_RA_LO_THRESH
void ADS1115::setMode |
( |
uint8_t |
mode | ) |
|
Set device mode.
- Parameters:
-
- See also:
- ADS1115_MODE_CONTINUOUS
-
ADS1115_MODE_SINGLESHOT
-
ADS1115_RA_CONFIG
-
ADS1115_CFG_MODE_BIT
void ADS1115::setMultiplexer |
( |
uint8_t |
mux | ) |
|
Set multiplexer connection.
- Parameters:
-
mux | New multiplexer connection setting |
- See also:
- ADS1115_MUX_P0_N1
-
ADS1115_MUX_P0_N3
-
ADS1115_MUX_P1_N3
-
ADS1115_MUX_P2_N3
-
ADS1115_MUX_P0_NG
-
ADS1115_MUX_P1_NG
-
ADS1115_MUX_P2_NG
-
ADS1115_MUX_P3_NG
-
ADS1115_RA_CONFIG
-
ADS1115_CFG_MUX_BIT
-
ADS1115_CFG_MUX_LENGTH
void ADS1115::setOpStatus |
( |
uint8_t |
status | ) |
|
Set operational status. This bit can only be written while in power-down mode (no conversions active).
- Parameters:
-
status | New operational status (0 does nothing, 1 to trigger conversion) |
- See also:
- ADS1115_RA_CONFIG
-
ADS1115_CFG_OS_BIT
void ADS1115::setRate |
( |
uint8_t |
rate | ) |
|
Set data rate.
- Parameters:
-
- See also:
- ADS1115_RATE_8
-
ADS1115_RATE_16
-
ADS1115_RATE_32
-
ADS1115_RATE_64
-
ADS1115_RATE_128
-
ADS1115_RATE_250
-
ADS1115_RATE_475
-
ADS1115_RATE_860
-
ADS1115_RA_CONFIG
-
ADS1115_CFG_DR_BIT
-
ADS1115_CFG_DR_LENGTH
bool ADS1115::testConnection |
( |
| ) |
|
Verify the I2C connection. Make sure the device is connected and responds as expected.
- Returns:
- True if connection is valid, false otherwise
The documentation for this class was generated from the following files: