feat: Add keyboard physical layout system.

* Add bindings to allow creating multiple physical layouts that specify
  their key's physical attributes, and the matching matrix transform
  and dependant kscan to use.
* Synthesize a basic physical layout if none specified, for backwards
  compatibility.
* Update matrix transform API to explicitly pass in the selected transform
  to the API instead of using a fixed chosen transform.
* Move kscan subscription and handling into the physical layout code, so
  that selecting a different physical layout at runtime can also use the
  correct kscan instance.
* Add `physical_layouts.dtsi` file to include so you can use the
  pre-configured `&key_physical_attrs` for adding you layout keys.
This commit is contained in:
Peter Johanson
2024-04-24 18:14:02 -07:00
committed by Pete Johanson
parent 80173f8ea3
commit c5cca5b34f
13 changed files with 604 additions and 141 deletions

View File

@@ -12,18 +12,11 @@
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(zmk, CONFIG_ZMK_LOG_LEVEL);
#include <zmk/matrix.h>
#include <zmk/kscan.h>
#include <zmk/display.h>
#include <drivers/ext_power.h>
int main(void) {
LOG_INF("Welcome to ZMK!\n");
if (zmk_kscan_init(DEVICE_DT_GET(ZMK_MATRIX_NODE_ID)) != 0) {
return -ENOTSUP;
}
#if IS_ENABLED(CONFIG_SETTINGS)
settings_subsys_init();
settings_load();