storage.h 766 B

12345678910111213141516171819202122
  1. /*
  2. * SPDX-FileCopyrightText: 2022-2023 Helmut Pozimski <helmut@pozimski.eu>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0-only
  5. */
  6. #include <stdint.h>
  7. #include <time.h>
  8. #include <esp_err.h>
  9. #include <nvs_flash.h>
  10. #define NUM_WEEK_DAYS 7
  11. static const char WEEK_DAYS[NUM_WEEK_DAYS][4] = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
  12. esp_err_t storage_init(const char* name);
  13. esp_err_t write_wakeup_time_tm(struct tm* datetime, int16_t value);
  14. esp_err_t write_wakeup_time_str(const char* key, int16_t value);
  15. esp_err_t read_wakeup_time_tm(struct tm* datetime, int16_t* value);
  16. esp_err_t read_wakeup_time_str(const char* key, int16_t* value);
  17. esp_err_t delete_wakeup_time_str(const char* key);
  18. void delete_outdated_entries(struct tm* datetime, const char* namespace);