NTC_THERMISTOR Driver 0.1.0
API reference
Loading...
Searching...
No Matches
ntc_thermistor_kconfig.hpp
Go to the documentation of this file.
1
14#ifndef NTC_THERMISTOR_KCONFIG_HPP
15#define NTC_THERMISTOR_KCONFIG_HPP
16
17#ifdef __has_include
18#if __has_include("sdkconfig.h")
19#include "sdkconfig.h"
20#endif
21#endif
22
25
26#ifndef CONFIG_NTC_THERMISTOR_ADC_CHANNEL
28#define CONFIG_NTC_THERMISTOR_ADC_CHANNEL 0
29#endif
30#ifndef CONFIG_NTC_THERMISTOR_ADC_BITS
32#define CONFIG_NTC_THERMISTOR_ADC_BITS 12
33#endif
34#ifndef CONFIG_NTC_THERMISTOR_SERIES_OHM
36#define CONFIG_NTC_THERMISTOR_SERIES_OHM 10000
37#endif
38#ifndef CONFIG_NTC_THERMISTOR_SAMPLES
40#define CONFIG_NTC_THERMISTOR_SAMPLES 1
41#endif
42
43namespace ntc_thermistor {
44
45namespace detail {
46
48[[nodiscard]] constexpr Curve KconfigCurve() noexcept {
49#ifdef CONFIG_NTC_THERMISTOR_CURVE_TDK_NTCG163JF103FT1S
51#elif defined(CONFIG_NTC_THERMISTOR_CURVE_GENERIC_B3950)
53#elif defined(CONFIG_NTC_THERMISTOR_CURVE_R25_B)
54 Curve c{};
55 c.r0_ohm = static_cast<uint32_t>(CONFIG_NTC_THERMISTOR_R25_OHM);
56 c.b_kelvin = static_cast<uint32_t>(CONFIG_NTC_THERMISTOR_B_KELVIN);
57 return c;
58#else
59 return Curve{};
60#endif
61}
62
63} // namespace detail
64
71[[nodiscard]] constexpr Config KconfigDefaults() noexcept {
72 Config c{};
73 c.curve = detail::KconfigCurve();
74 c.adc_channel = static_cast<uint8_t>(CONFIG_NTC_THERMISTOR_ADC_CHANNEL);
75 c.adc_bits = static_cast<uint8_t>(CONFIG_NTC_THERMISTOR_ADC_BITS);
76 c.series_ohm = static_cast<uint32_t>(CONFIG_NTC_THERMISTOR_SERIES_OHM);
77 c.sample_count = static_cast<uint8_t>(CONFIG_NTC_THERMISTOR_SAMPLES);
78#ifdef CONFIG_NTC_THERMISTOR_HIGH_SIDE
79 c.topology = Topology::NtcHighSide;
80#endif
81#if defined(CONFIG_NTC_THERMISTOR_MIN_TEMPERATURE_C) && \
82 defined(CONFIG_NTC_THERMISTOR_MAX_TEMPERATURE_C)
83 c.min_temperature_mc = static_cast<int32_t>(CONFIG_NTC_THERMISTOR_MIN_TEMPERATURE_C) * 1000;
84 c.max_temperature_mc = static_cast<int32_t>(CONFIG_NTC_THERMISTOR_MAX_TEMPERATURE_C) * 1000;
85#endif
86 return c;
87}
88
89} // namespace ntc_thermistor
90
91#endif // NTC_THERMISTOR_KCONFIG_HPP
constexpr Curve kGeneric10kB3950
The common 10 kOhm / B 3950 class (B25/50), beta mode: typical values of probes and beads,...
Definition ntc_thermistor_presets.hpp:108
constexpr Curve kTdkNtcg163jf103ft1s
TDK NTCG163JF103FT1S: R25 10 kOhm +-1 %, B25/85 3435 K +-1 %, table mode. R25, B and both tolerances ...
Definition ntc_thermistor_presets.hpp:93
The NTC thermistor driver: everything it declares lives here; internals in detail.
Definition ntc_thermistor.hpp:25
constexpr Config KconfigDefaults() noexcept
The configuration menuconfig selected.
Definition ntc_thermistor_kconfig.hpp:71
#define CONFIG_NTC_THERMISTOR_SERIES_OHM
Definition ntc_thermistor_kconfig.hpp:36
#define CONFIG_NTC_THERMISTOR_ADC_BITS
Definition ntc_thermistor_kconfig.hpp:32
#define CONFIG_NTC_THERMISTOR_ADC_CHANNEL
Definition ntc_thermistor_kconfig.hpp:28
#define CONFIG_NTC_THERMISTOR_SAMPLES
Definition ntc_thermistor_kconfig.hpp:40
Example curves as data. The driver includes this header nowhere: a preset is a convenience,...
Public types of the NTC thermistor driver: errors, Result<T>, the curve and the configuration,...
Everything one thermistor and its divider need. There is no default part: a Config{} fails Validate()...
Definition ntc_thermistor_types.hpp:284
Curve curve
The thermistor.
Definition ntc_thermistor_types.hpp:285
uint32_t r0_ohm
R at ref_temperature_mc (R25), 1 to kMaxR0Ohm; beta mode.
Definition ntc_thermistor_types.hpp:263