FDO2 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
fdo2_kconfig.hpp
Go to the documentation of this file.
1
20#ifndef FDO2_KCONFIG_HPP
21#define FDO2_KCONFIG_HPP
22
23#ifdef __has_include
24#if __has_include("sdkconfig.h")
25#include "sdkconfig.h"
26#endif
27#endif
28
29#include "fdo2_types.hpp"
30
31#ifndef CONFIG_FDO2_POWER_UP_MS
33#define CONFIG_FDO2_POWER_UP_MS 1500
34#endif
35#ifndef CONFIG_FDO2_MEASUREMENT_MS
37#define CONFIG_FDO2_MEASUREMENT_MS 300
38#endif
39#ifndef CONFIG_FDO2_RETRIES
41#define CONFIG_FDO2_RETRIES 1
42#endif
43#ifndef CONFIG_FDO2_MAX_FLASH_WRITES
45#define CONFIG_FDO2_MAX_FLASH_WRITES 8
46#endif
47
48namespace fdo2 {
49
55constexpr Config KconfigDefaults() noexcept {
56 Config c{};
57#ifdef CONFIG_FDO2_FAMILY_LEGACY
59#endif
60#ifdef CONFIG_FDO2_STATUS_POLICY_DOCUMENTED
61 c.status_policy = StatusPolicy::Documented;
62#endif
63 c.power_up_ms = CONFIG_FDO2_POWER_UP_MS;
64 c.measurement_ms = CONFIG_FDO2_MEASUREMENT_MS;
65 c.retries = CONFIG_FDO2_RETRIES;
66#ifdef CONFIG_FDO2_CRC_OFF
67 c.crc = CrcMode::Off;
68#else
69#ifdef CONFIG_FDO2_CRC_REQUIRED
70 c.crc = CrcMode::Required;
71#else
72 c.crc = CrcMode::Auto;
73#endif
74#endif
75#ifdef CONFIG_FDO2_BROADCAST_STREAM
76 c.broadcast = BroadcastPolicy::Stream;
77#else
78#ifdef CONFIG_FDO2_BROADCAST_DISABLE
79 c.broadcast = BroadcastPolicy::Disable;
80#else
81 c.broadcast = BroadcastPolicy::Refuse;
82#endif
83#endif
84#if defined(CONFIG_FDO2_ALLOW_PERSISTENT_WRITES) && CONFIG_FDO2_ALLOW_PERSISTENT_WRITES
85 c.allow_persistent_writes = true;
86#endif
87 c.max_flash_writes = CONFIG_FDO2_MAX_FLASH_WRITES;
88 return c;
89}
90
91} // namespace fdo2
92
93#endif // FDO2_KCONFIG_HPP
#define CONFIG_FDO2_RETRIES
Definition fdo2_kconfig.hpp:41
#define CONFIG_FDO2_MEASUREMENT_MS
Definition fdo2_kconfig.hpp:37
#define CONFIG_FDO2_MAX_FLASH_WRITES
Definition fdo2_kconfig.hpp:45
#define CONFIG_FDO2_POWER_UP_MS
Definition fdo2_kconfig.hpp:33
Public types of the FDO2 driver: errors, Result<T>, the status word, measurements,...
@ Fdo2
FDO2, the legacy module (firmware 3.28 to 3.55); no #SETM in its data sheet.
@ Auto
Learn from the first #VERS reply: a suffix means CRC is on.
@ Required
Every reply must carry a valid suffix (except #ERRO with erro_without_crc).
@ Off
Never expect a suffix: a reply with one is InvalidReply.
@ Disable
Send #BCST 0 (a flash write: needs allow_persistent_writes).
@ Refuse
Fail with BroadcastActive; the driver stays uninitialised.
@ Stream
Go to the Streaming state and decode the frames.
@ Documented
Only fatal and undefined bits are SensorFault; bits 7, 9, 10 are Degraded.
The FDO2 driver: everything it declares lives here; internals in detail.
Definition fdo2.hpp:33
constexpr Config KconfigDefaults() noexcept
The configuration menuconfig selected, on top of the defaults of Config{}.
Definition fdo2_kconfig.hpp:55
Everything the driver needs from the application, with the datasheet defaults.
Definition fdo2_types.hpp:516
Family family
Decides whether #SETM is attempted (A-3).
Definition fdo2_types.hpp:517