BASIS 2 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
alicat_basis2_kconfig.hpp
Go to the documentation of this file.
1
21#ifndef ALICAT_BASIS2_KCONFIG_HPP
22#define ALICAT_BASIS2_KCONFIG_HPP
23
24#ifdef __has_include
25#if __has_include("sdkconfig.h")
26#include "sdkconfig.h"
27#endif
28#endif
29
31
32#ifndef CONFIG_ALICAT_BASIS2_PROCESSING_MS
34#define CONFIG_ALICAT_BASIS2_PROCESSING_MS 50
35#endif
36#ifndef CONFIG_ALICAT_BASIS2_SLOW_COMMAND_MS
39#define CONFIG_ALICAT_BASIS2_SLOW_COMMAND_MS 1000
40#endif
41#ifndef CONFIG_ALICAT_BASIS2_READ_RETRIES
43#define CONFIG_ALICAT_BASIS2_READ_RETRIES 1
44#endif
45
46namespace alicat_basis2 {
47
48static_assert((CONFIG_ALICAT_BASIS2_PROCESSING_MS >= 1) &&
50 "ALICAT_BASIS2_PROCESSING_MS must be 1 to 1000");
51static_assert(
54 "ALICAT_BASIS2_SLOW_COMMAND_MS must be at least the processing time and at most 10000");
56 "ALICAT_BASIS2_READ_RETRIES must be 0 to 3");
57
62constexpr Config KconfigDefaults() noexcept {
63 Config c{};
64#ifdef CONFIG_ALICAT_BASIS2_MODBUS
66#endif
67#ifdef CONFIG_ALICAT_BASIS2_BAUD_4800
68 c.baud = 4800U;
69#elif defined(CONFIG_ALICAT_BASIS2_BAUD_9600)
70 c.baud = 9600U;
71#elif defined(CONFIG_ALICAT_BASIS2_BAUD_19200)
72 c.baud = 19200U;
73#elif defined(CONFIG_ALICAT_BASIS2_BAUD_57600)
74 c.baud = 57600U;
75#elif defined(CONFIG_ALICAT_BASIS2_BAUD_115200)
76 c.baud = 115200U;
77#else
78 c.baud = 38400U;
79#endif
80 c.processing_ms = static_cast<uint16_t>(CONFIG_ALICAT_BASIS2_PROCESSING_MS);
81 c.slow_command_ms = static_cast<uint16_t>(CONFIG_ALICAT_BASIS2_SLOW_COMMAND_MS);
82 c.read_retries = static_cast<uint8_t>(CONFIG_ALICAT_BASIS2_READ_RETRIES);
83 return c;
84}
85
86} // namespace alicat_basis2
87
88#endif // ALICAT_BASIS2_KCONFIG_HPP
#define CONFIG_ALICAT_BASIS2_SLOW_COMMAND_MS
Definition alicat_basis2_kconfig.hpp:39
#define CONFIG_ALICAT_BASIS2_PROCESSING_MS
Definition alicat_basis2_kconfig.hpp:34
#define CONFIG_ALICAT_BASIS2_READ_RETRIES
Definition alicat_basis2_kconfig.hpp:43
Public types of the ALICAT_BASIS2 driver: errors, Result<T>, configuration, enumerations and the valu...
@ ModbusRtu
Modbus RTU, functions 3, 6 and 16 (M p.18 to 27).
The ALICAT_BASIS2 driver: everything it declares lives here; internals in detail.
Definition alicat_basis2.hpp:39
constexpr Config KconfigDefaults() noexcept
The configuration menuconfig selected, on top of the datasheet defaults.
Definition alicat_basis2_kconfig.hpp:62
The driver's configuration. Every default is the instrument's factory value or a documented driver ch...
Definition alicat_basis2_types.hpp:279
Protocol protocol
The protocol this object speaks.
Definition alicat_basis2_types.hpp:283