Skip to content

Commit

Permalink
Implement data driven wear leveling (qmk#21906)
Browse files Browse the repository at this point in the history
* DD encoder map, wear leveling

* remove encoder map from DD

let's avoid the support headache

* wear leveling: specify the allowed drivers by name

Co-authored-by: Ryan <fauxpark@gmail.com>

* Add additional params

* Relocate under eeprom

* disable parsing

---------

Co-authored-by: Dimitris Mantzouranis <d3xter93@gmail.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
  • Loading branch information
3 people authored and Lorenzo Castoldi committed Dec 27, 2023
1 parent c119365 commit 7005465
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
4 changes: 4 additions & 0 deletions data/mappings/info_config.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
"DYNAMIC_KEYMAP_EEPROM_MAX_ADDR": {"info_key": "dynamic_keymap.eeprom_max_addr", "value_type": "int"},
"DYNAMIC_KEYMAP_LAYER_COUNT": {"info_key": "dynamic_keymap.layer_count", "value_type": "int"},

// EEPROM
"WEAR_LEVELING_BACKING_SIZE": {"info_key": "eeprom.wear_leveling.backing_size", "value_type": "int", "to_json": false},
"WEAR_LEVELING_LOGICAL_SIZE": {"info_key": "eeprom.wear_leveling.logical_size", "value_type": "int", "to_json": false},

// Indicators
"LED_CAPS_LOCK_PIN": {"info_key": "indicators.caps_lock"},
"LED_NUM_LOCK_PIN": {"info_key": "indicators.num_lock"},
Expand Down
1 change: 1 addition & 0 deletions data/mappings/info_rules.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"STENO_ENABLE": {"info_key": "stenography.enabled", "value_type": "bool"},
"STENO_PROTOCOL": {"info_key": "stenography.protocol"},
"WAIT_FOR_USB": {"info_key": "usb.wait_for", "value_type": "bool"},
"WEAR_LEVELING_DRIVER": {"info_key": "eeprom.wear_leveling.driver"},
"WS2812_DRIVER": {"info_key": "ws2812.driver"},

// Items we want flagged in lint
Expand Down
14 changes: 13 additions & 1 deletion data/schemas/keyboard.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,19 @@
},
"eeprom": {
"properties": {
"driver": {"type": "string"}
"driver": {"type": "string"},
"wear_leveling": {
"type": "object",
"additionalProperties": false,
"properties": {
"driver": {
"type": "string",
"enum": ["custom", "embedded_flash", "legacy", "rp2040_flash", "spi_flash"]
},
"backing_size": {"$ref": "qmk.definitions.v1#/unsigned_int"},
"logical_size": {"$ref": "qmk.definitions.v1#/unsigned_int"}
}
}
}
},
"encoder": {
Expand Down
7 changes: 7 additions & 0 deletions docs/reference_info_json.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ Configures the [EEPROM](eeprom_driver.md) driver.
* `driver`
* The EEPROM backend to use. Must be one of `custom`, `i2c`, `legacy_stm32_flash`, `spi`, `transient`, `vendor`, `wear_leveling`.
* Default: `"vendor"`
* `wear_leveling`
* `driver`
* The driver to use. Must be one of `embedded_flash`, `legacy`, `rp2040_flash`, `spi_flash`, `custom`.
* `backing_size`
* Number of bytes used by the wear-leveling algorithm for its underlying storage, and needs to be a multiple of the logical size.
* `logical_size`
* Number of bytes “exposed” to the rest of QMK and denotes the size of the usable EEPROM.

## Encoder :id=encoder

Expand Down

0 comments on commit 7005465

Please sign in to comment.