nvs_utilities.h 1.2 KB

123456789101112131415161718192021222324252627
  1. #pragma once
  2. #include "esp_err.h"
  3. #include "nvs.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. extern const char current_namespace[];
  8. extern const char settings_partition[];
  9. #define NUM_BUFFER_LEN 101
  10. void initialize_nvs();
  11. esp_err_t store_nvs_value_len(nvs_type_t type, const char *key, void * data, size_t data_len);
  12. esp_err_t store_nvs_value(nvs_type_t type, const char *key, void * data);
  13. esp_err_t get_nvs_value(nvs_type_t type, const char *key, void*value, const uint8_t buf_size);
  14. void * get_nvs_value_alloc(nvs_type_t type, const char *key);
  15. void * get_nvs_value_alloc_for_partition(const char * partition,const char * ns,nvs_type_t type, const char *key, size_t * size);
  16. esp_err_t erase_nvs_for_partition(const char * partition, const char * ns,const char *key);
  17. esp_err_t store_nvs_value_len_for_partition(const char * partition,const char * ns,nvs_type_t type, const char *key, const void * data,size_t data_len);
  18. esp_err_t erase_nvs(const char *key);
  19. void print_blob(const char *blob, size_t len);
  20. const char *type_to_str(nvs_type_t type);
  21. nvs_type_t str_to_type(const char *type);
  22. esp_err_t erase_nvs_partition(const char * partition, const char * ns);
  23. void erase_settings_partition();
  24. #ifdef __cplusplus
  25. }
  26. #endif