|
TB2026-YDS Firmware
|
Settings service: persistent user-preference store backed by NVS. More...
#include "esp_err.h"#include <stdint.h>#include <stddef.h>Go to the source code of this file.
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. | |
Settings service: persistent user-preference store backed by NVS.
A thin, generic key/value wrapper over a single NVS namespace ("settings"). Other services and screens use it to remember a value across reboots without each one re-implementing its own NVS open/commit dance. The service does not know what any key means: callers own the keys, the types, and the defaults.
Typical use (e.g. OLED brightness, last-played position):
This service owns no task. Each accessor opens, reads/writes, commits, and closes the namespace; saves are rare (a user changing a preference), so the per-call handle keeps the implementation simple and stateless.
Bluetooth keeps its own NVS namespace ("bt") for the known-device list; this store is for scalar preferences, not that blob.