ESPHome  1.15.2
Public Member Functions | Protected Member Functions | Protected Attributes
esphome::ESPPreferences Class Reference

#include <preferences.h>

Public Member Functions

 ESPPreferences ()
 
void begin ()
 
ESPPreferenceObject make_preference (size_t length, uint32_t type, bool in_flash=DEFAULT_IN_FLASH)
 
template<typename T >
ESPPreferenceObject make_preference (uint32_t type, bool in_flash=DEFAULT_IN_FLASH)
 
void prevent_write (bool prevent)
 On the ESP8266, we can't override the first 128 bytes during OTA uploads as the eboot parameters are stored there. More...
 
bool is_prevent_write ()
 

Protected Member Functions

void save_esp8266_flash_ ()
 

Protected Attributes

friend ESPPreferenceObject
 
uint32_t current_offset_
 
uint32_t nvs_handle_
 
bool prevent_write_ {false}
 
uint32_t * flash_storage_
 
uint32_t current_flash_offset_
 

Detailed Description

Definition at line 52 of file preferences.h.

Constructor & Destructor Documentation

◆ ESPPreferences()

esphome::ESPPreferences::ESPPreferences ( )

Definition at line 169 of file preferences.cpp.

Member Function Documentation

◆ begin()

void esphome::ESPPreferences::begin ( )

Definition at line 175 of file preferences.cpp.

◆ is_prevent_write()

bool esphome::ESPPreferences::is_prevent_write ( )

Definition at line 226 of file preferences.cpp.

◆ make_preference() [1/2]

ESPPreferenceObject esphome::ESPPreferences::make_preference ( size_t  length,
uint32_t  type,
bool  in_flash = DEFAULT_IN_FLASH 
)

Definition at line 185 of file preferences.cpp.

◆ make_preference() [2/2]

template<typename T >
ESPPreferenceObject esphome::ESPPreferences::make_preference ( uint32_t  type,
bool  in_flash = DEFAULT_IN_FLASH 
)

Definition at line 88 of file preferences.h.

◆ prevent_write()

void esphome::ESPPreferences::prevent_write ( bool  prevent)

On the ESP8266, we can't override the first 128 bytes during OTA uploads as the eboot parameters are stored there.

Writing there during an OTA upload would invalidate applying the new firmware. During normal operation, we use this part of the RTC user memory, but stop writing to it during OTA uploads.

Parameters
preventWhether to prevent writing to the first 32 words of RTC user memory.

Definition at line 225 of file preferences.cpp.

◆ save_esp8266_flash_()

void esphome::ESPPreferences::save_esp8266_flash_ ( )
protected

Definition at line 103 of file preferences.cpp.

Field Documentation

◆ current_flash_offset_

uint32_t esphome::ESPPreferences::current_flash_offset_
protected

Definition at line 82 of file preferences.h.

◆ current_offset_

uint32_t esphome::ESPPreferences::current_offset_
protected

Definition at line 74 of file preferences.h.

◆ ESPPreferenceObject

friend esphome::ESPPreferences::ESPPreferenceObject
protected

Definition at line 72 of file preferences.h.

◆ flash_storage_

uint32_t* esphome::ESPPreferences::flash_storage_
protected

Definition at line 81 of file preferences.h.

◆ nvs_handle_

uint32_t esphome::ESPPreferences::nvs_handle_
protected

Definition at line 76 of file preferences.h.

◆ prevent_write_

bool esphome::ESPPreferences::prevent_write_ {false}
protected

Definition at line 80 of file preferences.h.


The documentation for this class was generated from the following files: