I have one structure that I want to store inside nvs using nvs blob. Before setting for the first time nvs_get_stats gives a result of used entries as 1. (Probably it is storing some data data).
I used a structure as below:
- typedef struct struct_name{
- uint32_t var1;
- uint32_t var2;
- uint32_t var3;
- }struct_name;
- ESP_ERROR_CHECK(nvs_open_from_partition("device_data", "device_data", NVS_READWRITE, &handle));
- nvs_get_stats("device_data",&nvsStats);
- ESP_LOGI("storage","used: %d, free: %d, total: %d, namespace count: %d", nvsStats.used_entries,
- nvsStats.free_entries, nvsStats.total_entries, nvsStats.namespace_count);
- esp_err_t result= nvs_get_blob(handle,DEVICE_DATA_KEY,(void *)&m_data, &size);
Please guide for this. I have to sue used entries as I want to store these structure for 100 times sequencially with different keys. To generate keys I have to use "used entries" from nvs_get_stats.
Thanks in advance.
Chinmay.