ADS1X15 Class
Item Index
Methods
Methods
ADS1X15
-
bus
-
address
ADS1X15 constructor
Parameters:
-
bus
Numberi2c bus the sensor is attached to.
-
address
NumberDevice address. Default is 0x48.
Returns:
name
()
String
Returns the name of the sensor
Returns:
getLastSample
-
reg
Returns the contents of conversion register without performing a conversion operation. Will use a multiplier based on the current gain setting to give the voltage as a float. Used internally to return the HI and LOW threshold values.
Parameters:
-
reg
Numberuint8_t value specifying register to read. Should generally be called with no parameter.
Returns:
getSample
-
mode
Performs a read as specified by ADS1X15::ADSMUXMOE and returns the value as a float. Uses getLastSample() internally to return voltage value.
mode ADSMUXMODE specifying inputs to be sampled.
Parameters:
-
mode
ADSMUXMODEundefined
Returns:
getGain
()
ADSGAIN
Returns the current gain setting being used by the device as an ADSGAIN value.
Returns:
setGain
-
gain
Sets the PGA gain bits to the desired gain. Default is +/- 2.094 volts.
Parameters:
-
gain
ADSGAINADSGAIN value reprenting the desired gain. See warnings in spec sheet.
getSPS
()
ADSSAMPLERATE
Returns the current device sample rate a an ADSSAMPLERATE value.
Returns:
setSPS
-
rate
Sets the sample rate of the device. This function needs to be overrode in subclasses as the ADS1115 and ADS1015 have different data rates.
Parameters:
-
rate
ADSSAMPLERATEundefined
getCompMode
()
Boolean
Returns the comparator mode. False = Traditional comparator with Hysteresis (default) True = Window Comparator
Returns:
setCompMode
-
mode
Sets the comparator mode of the device.
Parameters:
-
mode
Booleanbool value denoting mode. False = Traditional comparator with Hysteresis (default) True = Window Comparator
getCompPol
()
Boolean
Get comparator polarity. Reports the polarity of the ALERT/RDY pin. Returns: False = Active Low (default) True = Active High
Returns:
setCompPol
-
mode
Sets the comparator polarity. Controls the polarity of the ALERT/RDY pin.
Parameters:
-
mode
Booleanbool. False = Active Low (default) True = Active High
getCompLatch
()
Boolean
Returns bool representing the state of the comparator latching functionality. False = Non Latching comparator (default) True = Latching Comparator
Returns:
setCompLatch
-
mode
Sets bit controlling comparator operation.
Parameters:
-
mode
Booleanbool False = Non Latching comparator (default) True = Latching Comparator
getCompQue
()
ADSCOMP
Returns ADSCOMP value representing the state of comparator queue.
CQUE_1CONV = Assert after one conversion CQUE_2CONV = Assert after two conversions CQUE_2CONV = Assert after four conversions CQUE_NONE = Disable comparator (default)
Returns:
setCompQue
-
mode
Sets bits controlling Comparator queue operation.
Parameters:
-
mode
ADSCOMPADSCOMP enum. CQUE_1CONV = Assert after one conversion CQUE_2CONV = Assert after two conversions CQUE_2CONV = Assert after four conversions CQUE_NONE = Disable comparator (default)
getContinuous
()
Boolean
Returns bool reflecting state of device mode bit.
False = Power Down Single shot mode (default) True = Continuous conversion mode
Returns:
setContinuous
-
mode
Sets the state of device mode but.
Parameters:
-
mode
Booleanbool False = Power Down Single shot mode (default) True = Continuous conversion mode
getThresh
-
reg
Returns current high or low threshold setting.
Parameters:
-
reg
ADSTHRESHADSTHRES enum value. Returns 0.0 unless THRESH_HIGH or THRESH_LOW requested.
Returns:
setThresh
-
reg
-
value
Sets threshold levels or configures for conversion ready operation of ALERT/RDY output.
THRESH_LOW = Sets low thresh register. THRESH_HIGH = Sets high thresh register. CONVERSION_RDY = Configures conversion ready operation THRESH_DEFAULT = resets high/low registers to startup values.
Parameters:
-
reg
ADSTHRESHADSTHRESH enum
-
value
Numberfloat value to set threshold register to.