12 virtual bool save(
const uint8_t *data,
size_t len) = 0;
13 virtual bool load(uint8_t *data,
size_t len) = 0;
21 template<
typename T>
bool save(
const T *src) {
22 if (backend_ ==
nullptr)
24 return backend_->save(reinterpret_cast<const uint8_t *>(src),
sizeof(T));
27 template<
typename T>
bool load(T *dest) {
28 if (backend_ ==
nullptr)
30 return backend_->load(reinterpret_cast<uint8_t *>(dest),
sizeof(T));
47 virtual bool sync() = 0;
55 virtual bool reset() = 0;
57 template<typename T, enable_if_t<is_trivially_copyable<T>::value,
bool> =
true>
59 return this->make_preference(
sizeof(T), type, in_flash);
62 template<typename T, enable_if_t<is_trivially_copyable<T>::value,
bool> =
true>
64 return this->make_preference(
sizeof(T), type);
virtual bool load(uint8_t *data, size_t len)=0
ESPPreferenceObject make_preference(uint32_t type)
virtual bool save(const uint8_t *data, size_t len)=0
ESPPreferences * global_preferences
ESPPreferenceObject make_preference(uint32_t type, bool in_flash)
ESPPreferenceObject(ESPPreferenceBackend *backend)
Implementation of SPI Controller mode.