docs: Inline simple physical layout info in new shield guide (#2827)

docs: Inline simple physical layouts in new shield guide

docs: Fix broken anchor in module creation

docs: Make physical layout transform label consistent and comment
This commit is contained in:
Cem Aksoylar
2025-02-17 15:59:54 -08:00
committed by GitHub
parent 9d234cbb10
commit 8575fc8a9d
3 changed files with 31 additions and 5 deletions

View File

@@ -448,13 +448,39 @@ Also see the [matrix transform section](../../config/layout.md#matrix-transform)
### Physical Layout ### Physical Layout
Your keyboard will need to have a physical layout defined. Your keyboard will need to have a physical layout defined.
Read through our [dedicated page on physical layouts](./physical-layouts.md) for information on how to define a physical layout. Physical layouts organize the matrix transform, kscan and optionally the physical description of key positions in a single entity.
Once you have finished creating your physical layout, you should import the file in which it was created:
<Tabs groupId="physical-layouts" defaultValue="basic">
<TabItem value="basic" label="Basic">
If you are not planning to add support for [ZMK Studio](../../features/studio.md), you can add a `zmk,physical-layout`-compatible node for each physical layout your keyboard supports:
```dts
/ {
physical_layout0: physical_layout_0 { // First physical layout, use different naming for other layouts
compatible = "zmk,physical-layout";
display-name = "Default Layout";
kscan = <&kscan0>; // Label of the kscan node, optional if all layouts use the same
transform = <&default_transform>; // Label of the matrix transform for this layout
};
};
```
These nodes should be placed in `my_keyboard.overlay` for unibody keyboards and the shared `my_keyboard.dtsi` for splits.
</TabItem>
<TabItem value="studio" label="With ZMK Studio Support">
If you are planning to add support for [ZMK Studio](../../features/studio.md), you should follow the [physical layouts documentation](physical-layouts.md) to create a new file `my_keyboard-layouts.dtsi` which includes the physical layout definitions.
Once you have finished defining your physical layouts, import the `my_keyboard-layouts.dtsi` file at the top of your `my_keyboard.overlay` file (unibody) or `my_keyboard.dtsi` file (split).
```dts ```dts
#include "my_keyboard-layouts.dtsi" #include "my_keyboard-layouts.dtsi"
``` ```
</TabItem>
</Tabs>
### Chosen Node ### Chosen Node
Set the `chosen` node to a defined "default" physical layout. This should also be placed in the same file as the physical layout, i.e. `my_keyboard.overlay` for unibodies and `my_keyboard.dtsi` for split keyboards. Set the `chosen` node to a defined "default" physical layout. This should also be placed in the same file as the physical layout, i.e. `my_keyboard.overlay` for unibodies and `my_keyboard.dtsi` for split keyboards.

View File

@@ -30,8 +30,8 @@ Every physical layout needs a matrix transform, and optionally can also have a k
```dts title="<your keyboard>.dts | <your keyboard>.dtsi | <your keyboard>.overlay" ```dts title="<your keyboard>.dts | <your keyboard>.dtsi | <your keyboard>.overlay"
&physical_layout0 { &physical_layout0 {
kscan = <&kscan0>; kscan = <&kscan0>; // Label of the kscan node this layout uses
transform = <&matrix_transform0>; transform = <&default_transform>; // Label of the matrix transform this layout uses
}; };
``` ```

View File

@@ -65,7 +65,7 @@ name: <your module name>
Next, you need to define the options to build your module. These also go into `zephyr/module.yml`, as children of the `build` property. Commonly used options are: Next, you need to define the options to build your module. These also go into `zephyr/module.yml`, as children of the `build` property. Commonly used options are:
- The `depends` child property is used to specify a list of modules which the module depends on. The dependencies are referred to by their [module name](#module-name). - The `depends` child property is used to specify a list of modules which the module depends on. The dependencies are referred to by their [module name](#name).
- The `cmake` child property is used to identify a folder containing a `CMakeLists.txt` file that lists the CMake commands used to build source files. - The `cmake` child property is used to identify a folder containing a `CMakeLists.txt` file that lists the CMake commands used to build source files.
- The `kconfig` child property is used to identify the `Kconfig` file that defines configuration settings used by the module. - The `kconfig` child property is used to identify the `Kconfig` file that defines configuration settings used by the module.
- `settings` is a child property containing additional child properties, two of which are particularly relevant: - `settings` is a child property containing additional child properties, two of which are particularly relevant: