29#define STORE_TAG_WEATHER 0x13
30#define STORE_TAG_STOCK 0x21
31#define STORE_TAG_CALENDAR 0x31
32#define STORE_TAG_HEALTH 0x42
33#define STORE_TAG_LOCATION 0x51
34#define STORE_TAG_HRV 0x61
49static inline bool store_restore(uint32_t key,
void *state,
size_t size, uint8_t tag)
51 if (!persist_exists(key) || persist_get_size(key) != (
int)size)
59 if (persist_read_data(key, &stored,
sizeof(stored)) != (
int)
sizeof(stored) || stored != tag)
64 return persist_read_data(key, state, size) == (int)size;
78static inline bool store_save(uint32_t key,
void *state,
size_t size, uint8_t tag)
80 *(uint8_t *)state = tag;
81 return persist_write_data(key, state, size) == (int)size;
104bool store_save_changed(uint32_t key,
void *state,
size_t size,
size_t reading_size, uint8_t tag,
105 uint32_t *saved_sum);
122 uint32_t *saved_sum);
bool store_save_changed(uint32_t key, void *state, size_t size, size_t reading_size, uint8_t tag, uint32_t *saved_sum)
Save a store's blob only when its reading is different from what is already on flash.
Definition store_persist.c:10
static bool store_restore(uint32_t key, void *state, size_t size, uint8_t tag)
Restore a saved blob into state, but only when it is this store's own current layout.
Definition store_persist.h:49
static bool store_save(uint32_t key, void *state, size_t size, uint8_t tag)
Save a store's blob with its tag stamped in, so the next restore can recognize it.
Definition store_persist.h:78
bool store_restore_reading(uint32_t key, void *state, size_t size, size_t reading_size, uint8_t tag, uint32_t *saved_sum)
Restore a saved blob as store_restore does, and record the sum of the reading it holds.
Definition store_persist.c:33
A checksum of a store's reading, so a reply that brings nothing new costs no flash write.