ESPHome
2026.8.0-dev
Loading...
Searching...
No Matches
esphome
components
esp32
preference_backend.h
Go to the documentation of this file.
1
#pragma once
2
#ifdef USE_ESP32
3
4
#include <cstddef>
5
#include <cstdint>
6
7
namespace
esphome::esp32
{
8
9
class
ESP32PreferenceBackend
final {
10
public
:
11
bool
save
(
const
uint8_t *data,
size_t
len
);
12
bool
load
(uint8_t *data,
size_t
len
);
13
14
uint32_t
key
{0};
15
uint32_t
nvs_handle
{0};
// NVS (flash) path
16
uint16_t
rtc_offset
{0};
// RTC path: word offset into the RTC storage region
17
uint8_t
length_words
{0};
// RTC path: data length in 32-bit words
18
bool
in_flash
{
true
};
// true: store in NVS (flash); false: store in RTC memory
19
};
20
21
class
ESP32Preferences
;
22
ESP32Preferences
*
get_preferences
();
23
24
}
// namespace esphome::esp32
25
26
namespace
esphome
{
27
using
PreferenceBackend
=
esp32::ESP32PreferenceBackend
;
28
}
// namespace esphome
29
30
#endif
// USE_ESP32
esphome::esp32::ESP32PreferenceBackend
Definition
preference_backend.h:9
esphome::esp32::ESP32PreferenceBackend::load
bool load(uint8_t *data, size_t len)
Definition
preferences.cpp:92
esphome::esp32::ESP32PreferenceBackend::rtc_offset
uint16_t rtc_offset
Definition
preference_backend.h:16
esphome::esp32::ESP32PreferenceBackend::save
bool save(const uint8_t *data, size_t len)
Definition
preferences.cpp:72
esphome::esp32::ESP32PreferenceBackend::in_flash
bool in_flash
Definition
preference_backend.h:18
esphome::esp32::ESP32PreferenceBackend::key
uint32_t key
Definition
preference_backend.h:14
esphome::esp32::ESP32PreferenceBackend::length_words
uint8_t length_words
Definition
preference_backend.h:17
esphome::esp32::ESP32PreferenceBackend::nvs_handle
uint32_t nvs_handle
Definition
preference_backend.h:15
esphome::esp32::ESP32Preferences
Definition
preferences.h:19
esphome::esp32
Definition
crash_handler.cpp:150
esphome::esp32::get_preferences
ESP32Preferences * get_preferences()
Definition
preferences.cpp:302
esphome
Definition
a01nyub.cpp:7
esphome::len
const void size_t len
Definition
hal.h:64
uint32_t
static void uint32_t
Definition
crash_handler.cpp:141
esphome::PreferenceBackend
Definition
preference_backend.h:30
Generated by
1.12.0