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
48static inline bool store_restore(uint32_t key,
void *state,
size_t size, uint8_t tag)
50 if (!persist_exists(key) || persist_get_size(key) != (
int)size)
58 if (persist_read_data(key, &stored,
sizeof(stored)) != (
int)
sizeof(stored) || stored != tag)
63 return persist_read_data(key, state, size) == (int)size;
77static inline bool store_save(uint32_t key,
void *state,
size_t size, uint8_t tag)
79 *(uint8_t *)state = tag;
80 return persist_write_data(key, state, size) == (int)size;
103bool store_save_changed(uint32_t key,
void *state,
size_t size,
size_t reading_size, uint8_t tag,
104 uint32_t *saved_sum);
121 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:48
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:77
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.