11#include "ntc_thermistor_version.h"
319 uint32_t sample_delay_ms) noexcept;
381 return HF_NTC_THERMISTOR_VERSION_STRING;
386 return HF_NTC_THERMISTOR_VERSION_MAJOR;
391 return HF_NTC_THERMISTOR_VERSION_MINOR;
396 return HF_NTC_THERMISTOR_VERSION_PATCH;
405 AdcType *adc_interface_;
409 float filtered_temperature_;
410 bool filter_initialized_;
422 validateConfiguration(
const ntc_config_t &config)
const noexcept;
429 NtcError readAdcVoltage(
float *voltage_volts)
noexcept;
437 NtcError calculateResistance(
float voltage_volts,
438 float *resistance_ohms)
noexcept;
446 NtcError convertResistanceToTemperature(
float resistance_ohms,
447 float *temperature_celsius)
noexcept;
454 float applyFiltering(
float new_temperature)
noexcept;
460 void delayBetweenSamples() noexcept;
467 static
void initializeConfigForType(
NtcType ntc_type,
477 return HF_NTC_THERMISTOR_VERSION_STRING;
481#define NTC_THERMISTOR_HEADER_INCLUDED
483#include "../src/ntc_thermistor.ipp"
484#undef NTC_THERMISTOR_HEADER_INCLUDED
Hardware-agnostic NTC thermistor driver.
Definition ntc_thermistor.hpp:75
NtcError SetVoltageDivider(float series_resistance) noexcept
Set voltage divider parameters.
Definition ntc_thermistor.ipp:438
NtcError SetBetaValue(float beta_value) noexcept
Set beta value.
Definition ntc_thermistor.ipp:459
NtcError GetVoltage(float *voltage_volts) noexcept
Get voltage across thermistor.
Definition ntc_thermistor.ipp:291
NtcError SetFiltering(bool enable, float alpha=0.1F) noexcept
Enable/disable filtering.
Definition ntc_thermistor.ipp:492
NtcError SetSamplingParameters(uint32_t sample_count, uint32_t sample_delay_ms) noexcept
Set sampling parameters.
Definition ntc_thermistor.ipp:480
static constexpr uint8_t GetDriverVersionPatch() noexcept
Get the compiled driver patch version number.
Definition ntc_thermistor.hpp:395
NtcError ReadTemperatureCelsius(float *temperature_celsius) noexcept
Read temperature in Celsius.
Definition ntc_thermistor.ipp:144
static float FahrenheitToCelsius(float fahrenheit) noexcept
Convert Fahrenheit to Celsius.
Definition ntc_thermistor.ipp:520
NtcError SetConfiguration(const ntc_config_t &config) noexcept
Set configuration.
Definition ntc_thermistor.ipp:123
static constexpr const char * GetDriverVersion() noexcept
Get the compiled driver version string.
Definition ntc_thermistor.hpp:380
NtcError SetReferenceVoltage(float reference_voltage) noexcept
Set reference voltage.
Definition ntc_thermistor.ipp:449
static float CelsiusToKelvin(float celsius) noexcept
Convert Celsius to Kelvin.
Definition ntc_thermistor.ipp:525
NtcThermistor(NtcThermistor &&) noexcept=default
Move constructor.
NtcError SetConversionMethod(NtcConversionMethod method) noexcept
Set conversion method.
Definition ntc_thermistor.ipp:430
static const char * GetTypeString(NtcType type) noexcept
Get NTC type string.
Definition ntc_thermistor.ipp:575
NtcError ReadTemperatureFahrenheit(float *temperature_fahrenheit) noexcept
Read temperature in Fahrenheit.
Definition ntc_thermistor.ipp:195
NtcError SetCalibrationOffset(float offset_celsius) noexcept
Set calibration offset.
Definition ntc_thermistor.ipp:404
NtcError GetCalibrationOffset(float *offset_celsius) const noexcept
Get calibration offset.
Definition ntc_thermistor.ipp:410
NtcError GetResistance(float *resistance_ohms) noexcept
Get thermistor resistance.
Definition ntc_thermistor.ipp:272
static float KelvinToCelsius(float kelvin) noexcept
Convert Kelvin to Celsius.
Definition ntc_thermistor.ipp:530
NtcError ReadTemperature(ntc_reading_t *reading) noexcept
Read complete temperature information.
Definition ntc_thermistor.ipp:226
bool IsInitialized() const noexcept
Check if initialized.
Definition ntc_thermistor.ipp:106
NtcError GetConfiguration(ntc_config_t *config) const noexcept
Get current configuration.
Definition ntc_thermistor.ipp:112
static const char * GetErrorString(NtcError error) noexcept
Get error string.
Definition ntc_thermistor.ipp:535
NtcError SetAdcChannel(uint8_t adc_channel) noexcept
Set ADC channel.
Definition ntc_thermistor.ipp:469
static float CelsiusToFahrenheit(float celsius) noexcept
Convert Celsius to Fahrenheit.
Definition ntc_thermistor.ipp:515
bool Initialize() noexcept
Initialize the NTC thermistor driver.
Definition ntc_thermistor.ipp:56
NtcError GetRawAdcValue(uint32_t *adc_value) noexcept
Get raw ADC value.
Definition ntc_thermistor.ipp:304
NtcError ReadTemperatureKelvin(float *temperature_kelvin) noexcept
Read temperature in Kelvin.
Definition ntc_thermistor.ipp:210
static constexpr uint8_t GetDriverVersionMajor() noexcept
Get the compiled driver major version number.
Definition ntc_thermistor.hpp:385
NtcError ResetCalibration() noexcept
Reset calibration.
Definition ntc_thermistor.ipp:421
NtcThermistor(const NtcThermistor &)=delete
Copy constructor is deleted.
bool Deinitialize() noexcept
Deinitialize the NTC thermistor driver.
Definition ntc_thermistor.ipp:93
static constexpr uint8_t GetDriverVersionMinor() noexcept
Get the compiled driver minor version number.
Definition ntc_thermistor.hpp:390
NtcError Calibrate(float reference_temperature_celsius) noexcept
Calibrate the thermistor.
Definition ntc_thermistor.ipp:381
NtcThermistor & operator=(const NtcThermistor &)=delete
Assignment operator is deleted.
CRTP-based template interface for ADC used by NTC thermistor driver.
const char * GetNtcThermistorDriverVersion() noexcept
Get the NTC Thermistor driver version string (free function).
Definition ntc_thermistor.hpp:476
Type definitions for NTC thermistor driver.
NtcError
NTC thermistor error codes.
Definition ntc_types.hpp:24
NtcConversionMethod
Temperature conversion methods.
Definition ntc_types.hpp:82
NtcType
NTC thermistor types.
Definition ntc_types.hpp:58
NTC thermistor configuration structure.
Definition ntc_types.hpp:107
NTC thermistor reading structure.
Definition ntc_types.hpp:136