mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-23 13:03:13 +00:00
8ec1c74baf
* SavedStruct: Replace saved_struct_get_payload_size with saved_struct_get_metadata This new function can obtain the magic value, version and payload size all at once. This makes the function useful e.g. for backwards compatibility. * SavedStruct: const-qualify saved_struct_save * Toolbox: add saved struct documentation Co-authored-by: あく <alleteam@gmail.com>
30 lines
849 B
C
30 lines
849 B
C
#include "expansion_settings.h"
|
|
|
|
#include <storage/storage.h>
|
|
#include <toolbox/saved_struct.h>
|
|
|
|
#include "expansion_settings_filename.h"
|
|
|
|
#define EXPANSION_SETTINGS_PATH INT_PATH(EXPANSION_SETTINGS_FILE_NAME)
|
|
#define EXPANSION_SETTINGS_VERSION (0)
|
|
#define EXPANSION_SETTINGS_MAGIC (0xEA)
|
|
|
|
bool expansion_settings_load(ExpansionSettings* settings) {
|
|
furi_assert(settings);
|
|
return saved_struct_load(
|
|
EXPANSION_SETTINGS_PATH,
|
|
settings,
|
|
sizeof(ExpansionSettings),
|
|
EXPANSION_SETTINGS_MAGIC,
|
|
EXPANSION_SETTINGS_VERSION);
|
|
}
|
|
|
|
bool expansion_settings_save(const ExpansionSettings* settings) {
|
|
furi_assert(settings);
|
|
return saved_struct_save(
|
|
EXPANSION_SETTINGS_PATH,
|
|
settings,
|
|
sizeof(ExpansionSettings),
|
|
EXPANSION_SETTINGS_MAGIC,
|
|
EXPANSION_SETTINGS_VERSION);
|
|
}
|