mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-27 07:11:45 +03: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>
24 lines
666 B
C
24 lines
666 B
C
#include "bt_settings.h"
|
|
|
|
#include <furi.h>
|
|
#include <lib/toolbox/saved_struct.h>
|
|
#include <storage/storage.h>
|
|
|
|
#define BT_SETTINGS_PATH INT_PATH(BT_SETTINGS_FILE_NAME)
|
|
#define BT_SETTINGS_VERSION (0)
|
|
#define BT_SETTINGS_MAGIC (0x19)
|
|
|
|
bool bt_settings_load(BtSettings* bt_settings) {
|
|
furi_assert(bt_settings);
|
|
|
|
return saved_struct_load(
|
|
BT_SETTINGS_PATH, bt_settings, sizeof(BtSettings), BT_SETTINGS_MAGIC, BT_SETTINGS_VERSION);
|
|
}
|
|
|
|
bool bt_settings_save(const BtSettings* bt_settings) {
|
|
furi_assert(bt_settings);
|
|
|
|
return saved_struct_save(
|
|
BT_SETTINGS_PATH, bt_settings, sizeof(BtSettings), BT_SETTINGS_MAGIC, BT_SETTINGS_VERSION);
|
|
}
|