16#include "mcp9700_version.h"
67template <
typename AdcType>
143 return std::isfinite(v_zero_c_) && std::isfinite(v_per_c_) && v_per_c_ > 0.0F;
147 [[nodiscard]]
float VoltsAtZeroC() const noexcept {
return v_zero_c_; }
153 AdcType* adc_interface_;
154 uint8_t adc_channel_;
169 return HF_MCP9700_VERSION_STRING;
173#include "../src/mcp9700_thermistor.ipp"
Template driver for MCP9700 family sensors on a multiplexed ADC.
Definition mcp9700_thermistor.hpp:68
float SpecifiedMaxCelsius() const noexcept
Upper end of the specified range (°C).
Definition mcp9700_thermistor.hpp:128
Mcp9700Thermistor & operator=(const Mcp9700Thermistor &)=delete
float RangeMarginCelsius() const noexcept
Margin added on both sides of the specified range (°C).
Definition mcp9700_thermistor.hpp:131
Mcp9700Thermistor(const Mcp9700Thermistor &)=delete
bool HasValidCoefficients() const noexcept
True when the coefficients can be used: a finite offset and a finite slope above zero.
Definition mcp9700_thermistor.hpp:142
float SpecifiedMinCelsius() const noexcept
Lower end of the specified range (°C).
Definition mcp9700_thermistor.hpp:125
Error LastError() const noexcept
Why the last call that can fail failed; Error::kNone after a success.
Definition mcp9700_thermistor.hpp:134
~Mcp9700Thermistor() noexcept=default
bool Initialize() noexcept
Initialize the underlying ADC (calls EnsureInitialized on the adapter).
Definition mcp9700_thermistor.ipp:20
bool SetSpecifiedRange(float min_celsius, float max_celsius, float margin_celsius=kDefaultRangeMarginCelsius) noexcept
Set the temperature range a reading must fall in to be accepted.
Definition mcp9700_thermistor.ipp:90
float VoltsAtZeroC() const noexcept
Last configured output at 0 °C (volts).
Definition mcp9700_thermistor.hpp:147
bool ReadVoltage(float *voltage_v) noexcept
Read the raw sensor output voltage (volts at VOUT, as the adapter reports it).
Definition mcp9700_thermistor.ipp:70
bool ReadTemperatureCelsius(float *temperature_celsius) noexcept
Read temperature in degrees Celsius.
Definition mcp9700_thermistor.ipp:42
bool Deinitialize() noexcept
Release logical ownership; underlying ADC teardown is adapter-specific.
Definition mcp9700_thermistor.ipp:35
float VoltsPerCelsius() const noexcept
Last configured sensitivity (volts per °C).
Definition mcp9700_thermistor.hpp:150
const char * GetMcp9700DriverVersion() noexcept
Driver version string (from the generated mcp9700_version.h).
Definition mcp9700_thermistor.hpp:168
constexpr float kDefaultSpecifiedMaxCelsius
Default upper end of the specified temperature range (°C).
Definition mcp9700_thermistor.hpp:36
constexpr float kDefaultVoltsAtZeroC
Default output voltage at 0 °C (500 mV typical, MCP9700/MCP9700A).
Definition mcp9700_thermistor.hpp:22
Error
Why the last call failed (see Mcp9700Thermistor::LastError()).
Definition mcp9700_thermistor.hpp:48
@ kNone
The last call succeeded.
@ kInvalidArgument
Null adapter or null output pointer, or an invalid range.
@ kInvalidCoefficients
Offset not finite, or slope not a finite positive number.
@ kNotInitialized
Read before a successful Initialize(), or after Deinitialize().
@ kOutOfRange
The voltage is outside the plausible range: open, shorted or mis-scaled input.
@ kAdcError
EnsureInitialized() returned false or ReadChannelV() returned non-zero.
constexpr float kDefaultRangeMarginCelsius
Default plausibility margin (°C) added on both sides of the specified range.
Definition mcp9700_thermistor.hpp:45
constexpr float kDefaultVoltsPerCelsius
Default sensitivity (10 mV/°C typical).
Definition mcp9700_thermistor.hpp:25
constexpr float kDefaultSpecifiedMinCelsius
Default lower end of the specified temperature range (°C).
Definition mcp9700_thermistor.hpp:33
Definition mcp9700_thermistor.hpp:18