ads1115  0.2.0
ADS1115::Threshold Class Reference

#include "threshold.hpp"

Public Member Functions

 Threshold ()=default
 
 Threshold (const std::int16_t low, const std::int16_t high)
 
bool operator== (const Threshold &other) const =default
 
void set (const std::int16_t low, const std::int16_t high)
 
std::int16_t getHigh () const
 
std::int16_t getLow () const
 

Private Attributes

std::int16_t m_high = 32767
 
std::int16_t m_low = -32768
 

Detailed Description

Definition at line 12 of file threshold.hpp.

Constructor & Destructor Documentation

◆ Threshold() [1/2]

ADS1115::Threshold::Threshold ( )
default

◆ Threshold() [2/2]

ADS1115::Threshold::Threshold ( const std::int16_t  low,
const std::int16_t  high 
)

Definition at line 11 of file threshold.cpp.

12  {
13  set(low, high);
14  }

References set().

Here is the call graph for this function:

Member Function Documentation

◆ getHigh()

std::int16_t ADS1115::Threshold::getHigh ( ) const

Definition at line 31 of file threshold.cpp.

32  {
33  return m_high;
34  }

References m_high.

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

Here is the caller graph for this function:

◆ getLow()

std::int16_t ADS1115::Threshold::getLow ( ) const

Definition at line 35 of file threshold.cpp.

36  {
37  return m_low;
38  }

References m_low.

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

Here is the caller graph for this function:

◆ operator==()

bool ADS1115::Threshold::operator== ( const Threshold other) const
default

◆ set()

void ADS1115::Threshold::set ( const std::int16_t  low,
const std::int16_t  high 
)

Definition at line 16 of file threshold.cpp.

17  {
18  if ((std::bit_cast<std::uint16_t>(high) & 0x8000)
19  and !(std::bit_cast<std::uint16_t>(low) & 0x8000)) {
20  m_high = high;
21  m_low = low;
22  return;
23  }
24  if (high < low) {
25  throw std::runtime_error("The high threshold has to be bigger than the low threshold.");
26  }
27  m_high = high;
28  m_low = low;
29  }

References m_high, and m_low.

Referenced by TEST(), and Threshold().

Here is the caller graph for this function:

Member Data Documentation

◆ m_high

std::int16_t ADS1115::Threshold::m_high = 32767
private

Definition at line 14 of file threshold.hpp.

Referenced by getHigh(), and set().

◆ m_low

std::int16_t ADS1115::Threshold::m_low = -32768
private

Definition at line 15 of file threshold.hpp.

Referenced by getLow(), and set().


The documentation for this class was generated from the following files:
ADS1115::Threshold::set
void set(const std::int16_t low, const std::int16_t high)
Definition: threshold.cpp:16
ADS1115::Threshold::m_high
std::int16_t m_high
Definition: threshold.hpp:14
ADS1115::Threshold::m_low
std::int16_t m_low
Definition: threshold.hpp:15