ads1115  0.2.0
All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
ADS1115 Namespace Reference

Classes

class  ADS1115
 
struct  Config
 
class  Threshold
 

Enumerations

enum  ADDR : std::uint8_t { ADDR::GND = 0x48, ADDR::VDD = 0x49, ADDR::SDA = 0x4a, ADDR::SCL = 0x4b }
 This Enum describes the possible i2c bus addresses of a ADS1115. More...
 
enum  OS : std::uint16_t { OS::NON = 0x0000, OS::SINGLE_CONV = 0x8000 }
 
enum  MUX : std::uint16_t {
  MUX::AIN0_AIN1 = 0x0000, MUX::AIN0_AIN3 = 0x1000, MUX::AIN1_AIN3 = 0x2000, MUX::AIN2_AIN3 = 0x3000,
  MUX::AIN0_GND = 0x4000, MUX::AIN1_GND = 0x5000, MUX::AIN2_GND = 0x6000, MUX::AIN3_GND = 0x7000
}
 
enum  PGA : std::uint16_t {
  PGA::FS_6_144 = 0x0000, PGA::FS_4_096 = 0x0200, PGA::FS_2_048 = 0x0400, PGA::FS_1_024 = 0x0600,
  PGA::FS_0_512 = 0x0800, PGA::FS_0_256 = 0x0a00
}
 
enum  MODE : std::uint16_t { MODE::CONT_CONV = 0x0000, MODE::SINGLE_CONV = 0x0100 }
 
enum  DR : std::uint16_t {
  DR::SPS_8 = 0x0000, DR::SPS_16 = 0x0020, DR::SPS_32 = 0x0040, DR::SPS_64 = 0x0060,
  DR::SPS_128 = 0x0080, DR::SPS_250 = 0x00a0, DR::SPS_475 = 0x00c0, DR::SPS_860 = 0x00e0
}
 
enum  COMP_MODE : std::uint16_t { COMP_MODE::TRAD_COMP = 0x0000, COMP_MODE::WINDOW_COMP = 0x0010 }
 
enum  COMP_POL : std::uint16_t { COMP_POL::LOW = 0x0000, COMP_POL::HIGH = 0x0008 }
 
enum  COMP_LAT : std::uint16_t { COMP_LAT::NON_LATCHING = 0x0000, COMP_LAT::LATCHING = 0x0004 }
 
enum  COMP_QUE : std::uint16_t { COMP_QUE::ONE_CONV = 0x0000, COMP_QUE::TWO_CONV = 0x0001, COMP_QUE::FOUR_CONV = 0x0002, COMP_QUE::DISABLE_COMP = 0x0003 }
 

Variables

constexpr std::uint8_t conv_reg_addr = 0x00
 Address of the conversion register. More...
 
constexpr std::uint8_t conf_reg_addr = 0x01
 Address of the config register. More...
 
constexpr std::uint8_t lo_thresh_reg_addr = 0x02
 Address of the low threshold register. More...
 
constexpr std::uint8_t hi_thresh_reg_addr = 0x03
 Address of the high threshold register. More...
 
const static std::unordered_map< PGA, double > pga_voltage_map
 

Enumeration Type Documentation

◆ ADDR

enum ADS1115::ADDR : std::uint8_t
strong

This Enum describes the possible i2c bus addresses of a ADS1115.

Enumerator
GND 
VDD 
SDA 
SCL 

Definition at line 20 of file parameters.hpp.

20  : std::uint8_t {
21  GND = 0x48,
22  VDD = 0x49,
23  SDA = 0x4a,
24  SCL = 0x4b,
25  };

◆ COMP_LAT

enum ADS1115::COMP_LAT : std::uint16_t
strong

This enum describes the latching behaviour of the comparator. This enum controls whether the ALERT/RDY pin latches once asserted or clears once conversions are within the margin of the upper and lower threshold values. When COMP_LAT::NON_LATCHING, the ALERT/RDY pin does not latch when asserted. When COMP_LAT::LATCHING, the asserted ALERT/RDY pin remains latched until conversion data are read by the master or an appropriate SMBus alert response is sent by the master, the device responds with its address, and it is the lowest address currently asserting the ALERT/RDY bus line.

Enumerator
NON_LATCHING 
LATCHING 

Definition at line 129 of file parameters.hpp.

129  : std::uint16_t {
130  NON_LATCHING = 0x0000,
131  LATCHING = 0x0004,
132  };

◆ COMP_MODE

enum ADS1115::COMP_MODE : std::uint16_t
strong

This enum describes the mode of the comparator of the ADS1115.

Enumerator
TRAD_COMP 

Traditional comparator with hysteresis.

WINDOW_COMP 

Window comparator.

Definition at line 105 of file parameters.hpp.

105  : std::uint16_t {
107  TRAD_COMP = 0x0000,
109  WINDOW_COMP = 0x0010,
110  };

◆ COMP_POL

enum ADS1115::COMP_POL : std::uint16_t
strong

This enum describes the comparator polarity of the ADS1115. This enum controls the polarity of the ALERT/RDY pin. When COMP_POL::LOW the comparator output is active low. When COMP_POL::HIGH the ALERT/RDY pin is active high.

Enumerator
LOW 
HIGH 

Definition at line 116 of file parameters.hpp.

116  : std::uint16_t {
117  LOW = 0x0000,
118  HIGH = 0x0008,
119  };

◆ COMP_QUE

enum ADS1115::COMP_QUE : std::uint16_t
strong

This enum describes the state of the comparator queue. This enum performs two functions. When set to COMP_QUE::DISABLE_COMP, they disable the comparator function and put the ALERT/RDY pin into a high state. When set to any other value, they control the number of successive conversions exceeding the upper or lower thresholds required before asserting the ALERT/RDY pin.

Enumerator
ONE_CONV 
TWO_CONV 
FOUR_CONV 
DISABLE_COMP 

Definition at line 140 of file parameters.hpp.

140  : std::uint16_t {
141  ONE_CONV = 0x0000,
142  TWO_CONV = 0x0001,
143  FOUR_CONV = 0x0002,
144  DISABLE_COMP = 0x0003,
145  };

◆ DR

enum ADS1115::DR : std::uint16_t
strong

This enum describes the possible data rates of the ADS1115.

Enumerator
SPS_8 

DR = 8 SPS.

SPS_16 

DR = 16 SPS.

SPS_32 

DR = 32 SPS.

SPS_64 

DR = 64 SPS.

SPS_128 

DR = 128 SPS.

SPS_250 

DR = 250 SPS.

SPS_475 

DR = 475 SPS.

SPS_860 

DR = 860 SPS.

Definition at line 84 of file parameters.hpp.

84  : std::uint16_t {
86  SPS_8 = 0x0000,
88  SPS_16 = 0x0020,
90  SPS_32 = 0x0040,
92  SPS_64 = 0x0060,
94  SPS_128 = 0x0080,
96  SPS_250 = 0x00a0,
98  SPS_475 = 0x00c0,
100  SPS_860 = 0x00e0,
101  };

◆ MODE

enum ADS1115::MODE : std::uint16_t
strong

This enum describes the operational modes of the ADS1115.

Enumerator
CONT_CONV 

Sets the ADS1115 to continuous conversion mode.

SINGLE_CONV 

Sets the ADS1115 to power-down single-shot mode.

Definition at line 75 of file parameters.hpp.

75  : std::uint16_t {
77  CONT_CONV = 0x0000,
79  SINGLE_CONV = 0x0100,
80  };

◆ MUX

enum ADS1115::MUX : std::uint16_t
strong

This enum describes the possible values of the multiplexer bits of the configuration register. It is used to select the inputs from which the ADS1115 reads data.

Enumerator
AIN0_AIN1 
AIN0_AIN3 
AIN1_AIN3 
AIN2_AIN3 
AIN0_GND 
AIN1_GND 
AIN2_GND 
AIN3_GND 

Definition at line 43 of file parameters.hpp.

43  : std::uint16_t {
44  AIN0_AIN1 = 0x0000,
45  AIN0_AIN3 = 0x1000,
46  AIN1_AIN3 = 0x2000,
47  AIN2_AIN3 = 0x3000,
48  AIN0_GND = 0x4000,
49  AIN1_GND = 0x5000,
50  AIN2_GND = 0x6000,
51  AIN3_GND = 0x7000,
52  };

◆ OS

enum ADS1115::OS : std::uint16_t
strong

This Enum describes the possible values that can be writen to the operational status bit while the ADS1115 is in power down mode.

The operational status bit of the config register can only be writen when the ADS1115 is in power down mode.

Enumerator
NON 

No effect when the config register is writen.

SINGLE_CONV 

Starts a new conversion when the conversion register is writen.

Definition at line 33 of file parameters.hpp.

33  : std::uint16_t {
35  NON = 0x0000,
37  SINGLE_CONV = 0x8000,
38  };

◆ PGA

enum ADS1115::PGA : std::uint16_t
strong

This enum describes the possible values for the programable gain amplifier bits of the config register. This effectefly defines the full-scale of the analog inputs above which the output will be cliped.

Enumerator
FS_6_144 

FS = $\pm$ 6.144V.

FS_4_096 

FS = $\pm$ 4.096V.

FS_2_048 

FS = $\pm$ 2.048V.

FS_1_024 

FS = $\pm$ 1.024V.

FS_0_512 

FS = $\pm$ 0.512V.

FS_0_256 

FS = $\pm$ 0.256V.

Definition at line 58 of file parameters.hpp.

58  : std::uint16_t {
60  FS_6_144 = 0x0000,
62  FS_4_096 = 0x0200,
64  FS_2_048 = 0x0400,
66  FS_1_024 = 0x0600,
68  FS_0_512 = 0x0800,
70  FS_0_256 = 0x0a00,
71  };

Variable Documentation

◆ conf_reg_addr

constexpr std::uint8_t ADS1115::conf_reg_addr = 0x01
constexpr

Address of the config register.

Definition at line 13 of file parameters.hpp.

Referenced by ADS1115::ADS1115::read(), ADS1115::ADS1115::readRegConfig(), and ADS1115::ADS1115::setRegConfig().

◆ conv_reg_addr

constexpr std::uint8_t ADS1115::conv_reg_addr = 0x00
constexpr

Address of the conversion register.

Definition at line 11 of file parameters.hpp.

Referenced by ADS1115::ADS1115::read().

◆ hi_thresh_reg_addr

constexpr std::uint8_t ADS1115::hi_thresh_reg_addr = 0x03
constexpr

Address of the high threshold register.

Definition at line 17 of file parameters.hpp.

Referenced by ADS1115::ADS1115::readRegThreshold(), and ADS1115::ADS1115::setRegThreshold().

◆ lo_thresh_reg_addr

constexpr std::uint8_t ADS1115::lo_thresh_reg_addr = 0x02
constexpr

Address of the low threshold register.

Definition at line 15 of file parameters.hpp.

Referenced by ADS1115::ADS1115::readRegThreshold(), and ADS1115::ADS1115::setRegThreshold().

◆ pga_voltage_map

const static std::unordered_map<PGA, double> ADS1115::pga_voltage_map
static
Initial value:
{
{ PGA::FS_6_144, 6.144 }, { PGA::FS_4_096, 4.096 }, { PGA::FS_2_048, 2.048 },
{ PGA::FS_1_024, 1.024 }, { PGA::FS_0_512, 0.512 }, { PGA::FS_0_256, 0.256 },
}

Definition at line 147 of file parameters.hpp.

Referenced by ADS1115::ADS1115::fromVoltage(), and ADS1115::ADS1115::toVoltage().

ADS1115::COMP_QUE::DISABLE_COMP
@ DISABLE_COMP
ADS1115::COMP_LAT::NON_LATCHING
@ NON_LATCHING
ADS1115::PGA::FS_0_512
@ FS_0_512
FS = 0.512V.
ADS1115::PGA::FS_4_096
@ FS_4_096
FS = 4.096V.
ADS1115::COMP_MODE::WINDOW_COMP
@ WINDOW_COMP
Window comparator.
ADS1115::DR::SPS_475
@ SPS_475
DR = 475 SPS.
ADS1115::MUX::AIN0_AIN3
@ AIN0_AIN3
ADS1115::MUX::AIN3_GND
@ AIN3_GND
ADS1115::PGA::FS_2_048
@ FS_2_048
FS = 2.048V.
ADS1115::COMP_QUE::ONE_CONV
@ ONE_CONV
ADS1115::ADDR::VDD
@ VDD
ADS1115::COMP_LAT::LATCHING
@ LATCHING
ADS1115::MUX::AIN0_AIN1
@ AIN0_AIN1
ADS1115::DR::SPS_128
@ SPS_128
DR = 128 SPS.
ADS1115::PGA::FS_0_256
@ FS_0_256
FS = 0.256V.
ADS1115::MUX::AIN1_GND
@ AIN1_GND
ADS1115::DR::SPS_250
@ SPS_250
DR = 250 SPS.
ADS1115::MUX::AIN0_GND
@ AIN0_GND
ADS1115::PGA::FS_1_024
@ FS_1_024
FS = 1.024V.
ADS1115::DR::SPS_8
@ SPS_8
DR = 8 SPS.
ADS1115::OS::SINGLE_CONV
@ SINGLE_CONV
Starts a new conversion when the conversion register is writen.
ADS1115::DR::SPS_860
@ SPS_860
DR = 860 SPS.
ADS1115::COMP_QUE::TWO_CONV
@ TWO_CONV
ADS1115::ADDR::SDA
@ SDA
ADS1115::MUX::AIN1_AIN3
@ AIN1_AIN3
ADS1115::MUX::AIN2_AIN3
@ AIN2_AIN3
ADS1115::DR::SPS_64
@ SPS_64
DR = 64 SPS.
ADS1115::ADDR::SCL
@ SCL
ADS1115::OS::NON
@ NON
No effect when the config register is writen.
ADS1115::COMP_MODE::TRAD_COMP
@ TRAD_COMP
Traditional comparator with hysteresis.
ADS1115::PGA::FS_6_144
@ FS_6_144
FS = 6.144V.
ADS1115::COMP_POL::LOW
@ LOW
ADS1115::DR::SPS_16
@ SPS_16
DR = 16 SPS.
ADS1115::ADDR::GND
@ GND
ADS1115::MODE::CONT_CONV
@ CONT_CONV
Sets the ADS1115 to continuous conversion mode.
ADS1115::DR::SPS_32
@ SPS_32
DR = 32 SPS.
ADS1115::MUX::AIN2_GND
@ AIN2_GND
ADS1115::COMP_POL::HIGH
@ HIGH
ADS1115::COMP_QUE::FOUR_CONV
@ FOUR_CONV