mirror of
https://github.com/Valeh2012/PersonalVotingMachine
synced 2024-11-25 18:31:00 +02:00
24 lines
447 B
C++
24 lines
447 B
C++
/**
|
|
* @file NVSModule.cpp
|
|
* @brief NVSModule implementation file
|
|
* */
|
|
|
|
#include "nvs_flash.h"
|
|
#include "module.h"
|
|
|
|
esp_err_t NVSModule::init(){
|
|
|
|
ESP_LOGI(TAG, "initializing nvs");
|
|
esp_err_t ret = nvs_flash_init();
|
|
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
|
ESP_ERROR_CHECK(nvs_flash_erase());
|
|
ret = nvs_flash_init();
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
esp_err_t NVSModule::deinit(){
|
|
|
|
return nvs_flash_deinit();
|
|
}
|