SFM_FLOW_METER Driver 0.1.0
API reference
Loading...
Searching...
No Matches
sfm_flow_meter_kconfig.hpp
Go to the documentation of this file.
1
25#ifndef SFM_FLOW_METER_KCONFIG_HPP
26#define SFM_FLOW_METER_KCONFIG_HPP
27
28#ifdef __has_include
29#if __has_include("sdkconfig.h")
30#include "sdkconfig.h"
31#endif
32#endif
33
35
36#ifndef CONFIG_SFM_FLOW_METER_AVERAGING
38#define CONFIG_SFM_FLOW_METER_AVERAGING (-1)
39#endif
40#ifndef CONFIG_SFM_FLOW_METER_ERROR_LIMIT
43#define CONFIG_SFM_FLOW_METER_ERROR_LIMIT 5
44#endif
45
46namespace sfm {
47
54constexpr Config KconfigDefaults() noexcept {
55 Config c{};
56 constexpr std::int32_t kAveraging = CONFIG_SFM_FLOW_METER_AVERAGING;
57 if constexpr (kAveraging >= 0) {
58 c.averaging = static_cast<std::uint16_t>(kAveraging);
59 }
60#ifdef CONFIG_SFM_FLOW_METER_SCALING_LENIENT
61 c.scaling_check = ScalingCheck::Lenient;
62#elif defined(CONFIG_SFM_FLOW_METER_SCALING_OFF)
63 c.scaling_check = ScalingCheck::Off;
64#else
65 c.scaling_check = ScalingCheck::Strict;
66#endif
67#if defined(CONFIG_SFM_FLOW_METER_RANGE_FLAG) && CONFIG_SFM_FLOW_METER_RANGE_FLAG
68 c.range_policy = RangePolicy::Flag;
69#endif
70#if defined(CONFIG_SFM_FLOW_METER_TIMING_DATASHEET) && CONFIG_SFM_FLOW_METER_TIMING_DATASHEET
71 c.timing = TimingPolicy::Datasheet;
72#endif
73#if defined(CONFIG_SFM_FLOW_METER_ALLOW_GENERAL_CALL_RESET) && \
74 CONFIG_SFM_FLOW_METER_ALLOW_GENERAL_CALL_RESET
75 c.allow_general_call_reset = true;
76#endif
77#if defined(CONFIG_SFM_FLOW_METER_NO_RESTART_BEFORE_READ) && \
78 CONFIG_SFM_FLOW_METER_NO_RESTART_BEFORE_READ
79 c.restart_before_read = false;
80#endif
81 c.consecutive_error_limit = static_cast<std::uint8_t>(CONFIG_SFM_FLOW_METER_ERROR_LIMIT);
82 return c;
83}
84
85} // namespace sfm
86
87#endif // SFM_FLOW_METER_KCONFIG_HPP
@ Strict
Any difference or a wrong unit is DeviceFault.
@ Off
The sensor's values are used; only scale 0 and the unit are checked.
@ Datasheet
The part's own maxima; needs a known variant.
The SFM flow meter driver: everything it declares lives here; internals in detail.
Definition sfm_flow_meter.hpp:35
constexpr Config KconfigDefaults() noexcept
The configuration menuconfig selected, on top of the datasheet defaults.
Definition sfm_flow_meter_kconfig.hpp:54
#define CONFIG_SFM_FLOW_METER_AVERAGING
Definition sfm_flow_meter_kconfig.hpp:38
#define CONFIG_SFM_FLOW_METER_ERROR_LIMIT
Definition sfm_flow_meter_kconfig.hpp:43
Public types of the SFM flow meter driver: errors, Result<T>, the families, variants and gases,...
Everything EnsureInitialized() applies.
Definition sfm_flow_meter_types.hpp:437