This repository has been archived by the owner on Sep 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: refactored app settings to reduce storage usage (#12)
- Loading branch information
Showing
10 changed files
with
48 additions
and
62 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
|
||
#include <stdint.h> | ||
|
||
typedef uint8_t internal_storage_t; | ||
|
||
#define N_settings (*(volatile internal_storage_t *) PIC(&N_storage_real)) | ||
|
||
// flip a bit k = 0 to 7 for u8 | ||
#define _FLIP_BIT(n, k) (((n) ^ (1 << (k)))) | ||
|
||
// toggle a setting item | ||
#define SETTING_TOGGLE(_set) \ | ||
do { \ | ||
internal_storage_t _temp_settings = _FLIP_BIT(N_settings, _set); \ | ||
nvm_write((void *) &N_settings, (void *) &_temp_settings, sizeof(internal_storage_t)); \ | ||
} while (0) | ||
|
||
// check a setting item | ||
#define HAS_SETTING(k) ((N_settings & (1 << (k))) >> (k)) | ||
|
||
#define S_HASH_SIGNING_ENABLED 0 | ||
#define S_SEQUENCE_DISPLAY_ENABLED 1 | ||
|
||
#define S_INITIALIZED 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters