|
TB2026-YDS Firmware
|
Persistent key/value store for user preferences (NVS-backed). More...

Functions | |
| esp_err_t | settings_init (void) |
| Initialise NVS so the settings accessors can be used. | |
| esp_err_t | settings_get_u8 (const char *key, uint8_t *out) |
| Read a stored uint8 preference. | |
| esp_err_t | settings_set_u8 (const char *key, uint8_t val) |
| Store a uint8 preference and commit it. | |
| esp_err_t | settings_get_u32 (const char *key, uint32_t *out) |
| Read a stored uint32 preference. | |
| esp_err_t | settings_set_u32 (const char *key, uint32_t val) |
| Store a uint32 preference and commit it. | |
| esp_err_t | settings_get_str (const char *key, char *out, size_t out_size) |
| Read a stored NUL-terminated string preference. | |
| esp_err_t | settings_set_str (const char *key, const char *val) |
| Store a NUL-terminated string preference and commit it. | |
Persistent key/value store for user preferences (NVS-backed).
| esp_err_t settings_get_str | ( | const char * | key, |
| char * | out, | ||
| size_t | out_size ) |
Read a stored NUL-terminated string preference.
| [in] | key | NVS key (<= 15 chars). |
| [out] | out | Buffer to receive the string (always NUL-terminated on ESP_OK). |
| [in] | out_size | Size of out in bytes. |
out is too small, or another esp_err_t. | esp_err_t settings_get_u32 | ( | const char * | key, |
| uint32_t * | out ) |
Read a stored uint32 preference.
| [in] | key | NVS key (<= 15 chars). |
| [out] | out | Receives the stored value; untouched on error. |
| esp_err_t settings_get_u8 | ( | const char * | key, |
| uint8_t * | out ) |
Read a stored uint8 preference.
| [in] | key | NVS key (<= 15 chars). |
| [out] | out | Receives the stored value; untouched on error. |
| esp_err_t settings_init | ( | void | ) |
Initialise NVS so the settings accessors can be used.
Safe to call more than once and from any service's init: the underlying nvs_flash_init() is idempotent. Recovers a corrupt/outdated NVS partition by erasing and re-initialising it.
| esp_err_t settings_set_str | ( | const char * | key, |
| const char * | val ) |
Store a NUL-terminated string preference and commit it.
| esp_err_t settings_set_u32 | ( | const char * | key, |
| uint32_t | val ) |
Store a uint32 preference and commit it.
| esp_err_t settings_set_u8 | ( | const char * | key, |
| uint8_t | val ) |
Store a uint8 preference and commit it.