ESPHome 2026.5.0-dev
Loading...
Searching...
No Matches
preferences.h
Go to the documentation of this file.
1#pragma once
2#ifdef USE_ZEPHYR
3#ifdef CONFIG_SETTINGS
4
6#include <zephyr/settings/settings.h>
7#include <vector>
8
9namespace esphome::zephyr {
10
11class ZephyrPreferences final : public PreferencesMixin<ZephyrPreferences> {
12 public:
14 void open();
16 return this->make_preference(length, type);
17 }
19 bool sync();
20 bool reset();
21
22 protected:
23 std::vector<ZephyrPreferenceBackend *> backends_;
24
25 static int load_setting(const char *name, size_t len, settings_read_cb read_cb, void *cb_arg);
26 static int export_settings(int (*cb)(const char *name, const void *value, size_t val_len));
27};
28
30
31} // namespace esphome::zephyr
32
33DECLARE_PREFERENCE_ALIASES(esphome::zephyr::ZephyrPreferences)
34
35#endif // CONFIG_SETTINGS
36#endif // USE_ZEPHYR
CRTP mixin providing type-safe template make_preference<T>() helpers.
ESPPreferenceObject make_preference(size_t length, uint32_t type, bool in_flash)
Definition preferences.h:15
static int load_setting(const char *name, size_t len, settings_read_cb read_cb, void *cb_arg)
std::vector< ZephyrPreferenceBackend * > backends_
Definition preferences.h:23
static int export_settings(int(*cb)(const char *name, const void *value, size_t val_len))
uint16_t type
std::string size_t len
Definition helpers.h:1045
static void uint32_t
uint16_t length
Definition tt21100.cpp:0