17 #ifdef HAVE_APP_STORAGE
19 #include "app_storage.h"
25 const app_storage_t N_app_storage_real;
35 void app_storage_init(uint32_t data_version)
37 app_storage_header_t header = {0};
39 memcpy(header.tag, (
void *)
"NVRA", 4);
42 header.struct_version = APP_STORAGE_DATA_STRUCT_VERSION;
43 header.data_version = data_version;
44 header.properties = APP_STORAGE_PROPERTIES;
46 header.size =
sizeof(app_storage_data_t);
47 nvm_write((
void *) &N_app_storage.header, &header,
sizeof(header));
53 uint32_t app_storage_get_size(
void)
55 return N_app_storage.header.size;
61 uint16_t app_storage_get_struct_version(
void)
63 return N_app_storage.header.struct_version;
69 uint32_t app_storage_get_data_version(
void)
71 return N_app_storage.header.data_version;
77 uint16_t app_storage_get_properties(
void)
79 return N_app_storage.header.properties;
85 bool app_storage_is_initalized(
void)
87 if (memcmp((
void *) N_app_storage.header.tag,
"NVRA", 4)) {
90 if (N_app_storage.header.size == 0) {
99 void app_storage_set_data_version(uint32_t data_version)
101 nvm_write((
void *) &N_app_storage.header.data_version,
102 (
void *) &data_version,
103 sizeof(N_app_storage.header.data_version));