初始提交卡包 USB 工程
纳入固件源码、屏幕组件、nand_xfer 工具和文档。忽略本机构建产物、sdkconfig,以及含本机路径的依赖锁。 Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#include "nvs_flash.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "nvs.h"
|
||||
#include "esp_log.h"
|
||||
#include <string.h>
|
||||
|
||||
static const char *TAG = "emoji_information";
|
||||
|
||||
//NVS 命名空间
|
||||
#define NVS_NAMESPACE "emoji_config"
|
||||
//版本号的键名
|
||||
#define VERSION_KEY "emoji_version"
|
||||
|
||||
#define VERSION_BUF_SIZE 32
|
||||
|
||||
esp_err_t nvs_emoji_init(void) // nvs 初始化
|
||||
{
|
||||
esp_err_t err = nvs_flash_init();
|
||||
|
||||
if(err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND)
|
||||
{
|
||||
ESP_LOGI(TAG,"NVS paratition need erase , reinitializing ...");
|
||||
err = nvs_flash_erase();
|
||||
if(err != ESP_OK)
|
||||
{
|
||||
ESP_LOGI(TAG,"NVS flash erase failed : %s ", esp_err_to_name(err));
|
||||
return err;
|
||||
}
|
||||
err = nvs_flash_init();
|
||||
}
|
||||
|
||||
if(err != ESP_OK)
|
||||
{
|
||||
ESP_LOGI(TAG,"NVS initialization failed : %s",esp_err_to_name(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG,"NVS initialized successfully");
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#ifndef __NVS_FLASH_H__
|
||||
#define __NVS_FLASH_H__
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user