ESPHome 2026.5.0-dev
Loading...
Searching...
No Matches
preferences.h
Go to the documentation of this file.
1#pragma once
2
4
5// Include the concrete preferences manager for the active platform.
6// Each header defines its manager class and provides the Preferences,
7// ESPPreferences, and global_preferences declarations.
8#ifdef USE_ESP32
10#elif defined(USE_ESP8266)
12#elif defined(USE_RP2040)
14#elif defined(USE_LIBRETINY)
16#elif defined(USE_HOST)
18#elif defined(USE_ZEPHYR) && defined(CONFIG_SETTINGS)
20#else
21namespace esphome {
22struct Preferences : public PreferencesMixin<Preferences> {
24 ESPPreferenceObject make_preference(size_t, uint32_t, bool) { return {}; }
26
32 bool sync() { return false; }
33
40 bool reset() { return false; }
41};
43extern ESPPreferences *global_preferences; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
44} // namespace esphome
45#endif
CRTP mixin providing type-safe template make_preference<T>() helpers.
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
ESPPreferences * global_preferences
static void uint32_t
bool reset()
Forget all unsaved changes and re-initialize the permanent preferences storage.
Definition preferences.h:40
ESPPreferenceObject make_preference(size_t, uint32_t, bool)
Definition preferences.h:24
ESPPreferenceObject make_preference(size_t, uint32_t)
Definition preferences.h:25
bool sync()
Commit pending writes to flash.
Definition preferences.h:32