-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add more faqs, update storage doc
Signed-off-by: Haobo Gu <[email protected]>
- Loading branch information
Showing
2 changed files
with
81 additions
and
7 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,13 +1,38 @@ | ||
# Storage | ||
|
||
TODO: Update storage documentation | ||
Storage feature is used by saving keymap edits to internal flash. | ||
|
||
Storage feature is used by saving keymap edits to internal flash. By default, it uses **last 2 sectors** of your microcontroller's internal flash. So you have to ensure that you have enough flash space for storage feature if you pass the storage argument to RMK. If there is not enough space, passing `None` is acceptable. | ||
## Storage configuration | ||
|
||
If you're using nrf528xx + BLE, this feature is automatically enabled because it's required to saving BLE bond info. | ||
If you're using the `keyboard.toml`, you can set the storage using the following config: | ||
|
||
Future work: | ||
```toml | ||
[storage] | ||
# Storage feature is enabled by default | ||
enabled = true | ||
# Start address of local storage, MUST BE start of a sector. | ||
# If start_addr is set to 0(this is the default value), the last `num_sectors` sectors will be used. | ||
start_addr = 0x00000000 | ||
# How many sectors are used for storage, the default value is 2 | ||
num_sectors = 2 | ||
``` | ||
|
||
- [ ] make it configurable that how many sectors to be used(but at least 2) | ||
- [ ] add storage to RMK feature gate, disable all related stuffs if the feature is not enabled. This could save a lot of flash | ||
- [ ] Save more configurations to storage | ||
You can also edit `storage_config` field in `RmkConfig` if you're using Rust API: | ||
|
||
```rust | ||
// https://github.com/HaoboGu/rmk/blob/main/examples/use_rust/nrf52832_ble/src/main.rs#L48 | ||
|
||
let storage_config = StorageConfig { | ||
start_addr: 0x70000, | ||
num_sectors: 2, | ||
}; | ||
let keyboard_config = RmkConfig { | ||
usb_config: keyboard_usb_config, | ||
vial_config, | ||
storage_config, | ||
..Default::default() | ||
}; | ||
|
||
``` | ||
|
||
By default, RMK uses **last 2 sectors** of your microcontroller's internal flash as the storage space. So you have to ensure that you have enough flash space for storage feature. If there is not enough space, passing `None` is acceptable. |