X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=docs%2Ffeature_layouts.md;h=1ee8b5e35c6ea1e4bbcf86341ad8efc7c6d89d40;hb=159191a8747891920aea7de2324507daa8a661fb;hp=24c42c09feb1867f0cd885adba47035c4217c843;hpb=bb53635f33c213e5a940edea8b07026ef89aed42;p=qmk_firmware.git diff --git a/docs/feature_layouts.md b/docs/feature_layouts.md index 24c42c09f..1ee8b5e35 100644 --- a/docs/feature_layouts.md +++ b/docs/feature_layouts.md @@ -35,10 +35,12 @@ New names should try to stick to the standards set by existing layouts, and can ## Supporting a Layout -For a keyboard to support a layout, the variable (`[a-z0-9_]`) must be defined in it's `.h`, and match the number of arguments/keys (and preferably the physical layout): +For a keyboard to support a layout, the variable must be defined in it's `.h`, and match the number of arguments/keys (and preferably the physical layout): #define LAYOUT_60_ansi KEYMAP_ANSI +The name of the layout must match this regex: `[a-z0-9_]+` + The folder name must be added to the keyboard's `rules.mk`: LAYOUTS = 60_ansi @@ -51,6 +53,8 @@ but the `LAYOUT_` variable must be defined in `.h` as well. ## Tips for Making Layouts Keyboard-Agnostic +### Includes + Instead of using `#include "planck.h"`, you can use this line to include whatever `.h` (`.h` should not be included here) file that is being compiled: #include QMK_KEYBOARD_H @@ -70,3 +74,7 @@ For example: ``` Note that the names are lowercase and match the folder/file names for the keyboard/revision exactly. + +### Keymaps + +In order to support both split and non-split keyboards with the same layout, you need to use the keyboard agnostic `LAYOUT_` macro in your keymap. For instance, in order for a Let's Split and Planck to share the same layout file, you need to use `LAYOUT_ortho_4x12` instead of `LAYOUT_planck_grid` or just `{}` for a C array.