NTC_THERMISTOR Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Namespaces | Functions
ntc_thermistor_conversion.hpp File Reference

From an ADC code to a temperature: the divider, the curve, the bound, and the helpers around them. Pure functions of a Config and a code; no port, no state. More...

#include <cstddef>
#include <cstdint>
#include <limits>
#include <span>
#include "ntc_thermistor_detail.hpp"
#include "ntc_thermistor_math.hpp"
#include "ntc_thermistor_types.hpp"

Go to the source code of this file.

Namespaces

namespace  ntc_thermistor
 The NTC thermistor driver: everything it declares lives here; internals in detail.
 

Functions

constexpr Result< Reading > ntc_thermistor::Convert (const Config &config, uint32_t mean_code) noexcept
 The pure conversion: the maths for an ADC code, with no port and no state.
 
constexpr Result< uint32_t > ntc_thermistor::ConvertResistance (const Config &config, uint32_t mean_code) noexcept
 The thermistor's resistance for a code: the divider arithmetic only, with no curve and no window.
 
constexpr int32_t ntc_thermistor::ToMilliKelvin (int32_t mc) noexcept
 A temperature in milli-kelvin.
 
constexpr int32_t ntc_thermistor::ToMilliFahrenheit (int32_t mc) noexcept
 A temperature in milli-degrees Fahrenheit.
 
constexpr uint32_t ntc_thermistor::SelfHeatingMicrowatts (const Config &config, uint32_t r_ntc_ohm) noexcept
 The power the divider puts into the thermistor, in microwatts: V^2 * Rn / (Rs + Rn)^2.
 

Detailed Description

From an ADC code to a temperature: the divider, the curve, the bound, and the helpers around them. Pure functions of a Config and a code; no port, no state.

The pipeline (docs/conversion.md): classify the code (open, short, out of scale), the divider to ohms, the curve to milli-degrees Celsius (a table interpolated in ln R, or the beta equation), the window, the offset, and the uncertainty bound. Only integer arithmetic: no libm, no floating point, no loop without a constant bound.