<spanclass="line"><span>☒ Lint check failed!</span></span></code></pre></div><h2id="naming-your-keyboard-project"tabindex="-1">Naming Your Keyboard/Project <aclass="header-anchor"href="#naming-your-keyboard-project"aria-label="Permalink to "Naming Your Keyboard/Project""></a></h2><p>All keyboard names are in lower case, consisting only of letters, numbers, and underscore (<code>_</code>). Names may not begin with an underscore. Forward slash (<code>/</code>) is used as a sub-folder separation character.</p><p>The names <code>test</code>, <code>keyboard</code>, and <code>all</code> are reserved for make commands and may not be used as a keyboard or subfolder name.</p><p>Valid Examples:</p><ul><li><code>412_64</code></li><li><code>chimera_ortho</code></li><li><code>clueboard/66/rev3</code></li><li><code>planck</code></li><li><code>v60_type_r</code></li></ul><h2id="sub-folders"tabindex="-1">Sub-folders <aclass="header-anchor"href="#sub-folders"aria-label="Permalink to "Sub-folders""></a></h2><p>QMK uses sub-folders both for organization and to share code between revisions of the same keyboard. You can nest folders up to 4 levels deep:</p><divclass="language- vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang"></span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><span>qmk_firmware/keyboards/top_folder/sub_1/sub_2/sub_3/sub_4</span></span></code></pre></div><p>If a sub-folder has a <code>rules.mk</code> file it will be considered a compilable keyboard. It will be available in QMK Configurator and tested with <code>make all</code>. If you are using a folder to organize several keyboards from the same maker you should not have a <code>rules.mk</code> file.</p><p>Example:</p><p>Clueboard uses sub-folders for both purposes, organization and keyboard revisions.</p><ul><li><ahref="https://github.com/qmk/qmk_firmware/tree/master"target="_blank"rel="noreferrer"><code>qmk_firmware</code></a><ul><li><ahref="https://github.com/qmk/qmk_firmware/tree/master/keyboards"target="_blank"rel="noreferrer"><code>keyboards</code></a><ul><li><ahref="https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard"target="_blank"rel="noreferrer"><code>clueboard</code></a> ← This is the organization folder, there's no <code>rules.mk</code> file <ul><li><ahref="https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/60"target="_blank"rel="noreferrer"><code>60</code></a> ← This is a compilable keyboard, it has a <code>rules.mk</code> file</li><li><ahref="https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/66"target="_blank"rel="noreferrer"><code>66</code></a> ← This is also compilable- it uses <code>DEFAULT_FOLDER</code> to specify <code>rev3</code> as the default revision <ul><li><ahref="https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/66/rev1"target="_blank"rel="noreferrer"><code>rev1</code></a> ← compilable: <code>make clueboard/66/rev1</code></li><li><ahref="https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/66/rev2"target="_blank"rel="noreferrer"><code>rev2</code></a> ← compilable: <code>make clueboard/66/rev2</code></li><li><ahref="https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/66/rev3"target="_blank"rel="noreferrer"><code>rev3</code></a> ← compilable: <code>make clueboard/66/rev3</code> or <code>make clueboard/66</code></li></ul></li></ul></li></ul></li></ul></li></ul><h2id="keyboard-folder-structure"tabindex="-1">Keyboard Folder Structure <aclass="header-anchor"href="#keyboard-folder-structure"aria-label="Permalink to "Keyboard Folder Structure""></a></h2><p>Your keyboard should be located in <code>qmk_firmware/keyboards/</code> and the folder name should be your keyboard's name as described in the previous section. Inside this folder should be several files:</p><ul><li><code>readme.md</code></li><li><code>info.json</code></li><li><code>config.h</code></li><li><code>rules.mk</code
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">#endif</span></span></code></pre></div></li></ul><divclass="tip custom-block"><pclass="custom-block-title">TIP</p><p>If you define options using <code>post_config.h</code> as in the above example, you should not define the same options in the keyboard- or user-level <code>config.h</code>.</p></div><h3id="rules-mk"tabindex="-1"><code>rules.mk</code><aclass="header-anchor"href="#rules-mk"aria-label="Permalink to "`rules.mk`""></a></h3><p>The presence of this file means that the folder is a keyboard target and can be used in <code>make</code> commands. This is where you setup the build environment for your keyboard and configure the default set of features.</p><p>The <code>rules.mk</code> file can also be placed in a sub-folder, and its reading order is as follows:</p><ul><li><code>keyboards/top_folder/rules.mk</code><ul><li><code>keyboards/top_folder/sub_1/rules.mk</code><ul><li><code>keyboards/top_folder/sub_1/sub_2/rules.mk</code><ul><li><code>keyboards/top_folder/sub_1/sub_2/sub_3/rules.mk</code><ul><li><code>keyboards/top_folder/sub_1/sub_2/sub_3/sub_4/rules.mk</code><ul><li><code>keyboards/top_folder/keymaps/a_keymap/rules.mk</code></li><li><code>users/a_user_folder/rules.mk</code></li></ul></li><li><code>keyboards/top_folder/sub_1/sub_2/sub_3/sub_4/post_rules.mk</code></li></ul></li><li><code>keyboards/top_folder/sub_1/sub_2/sub_3/post_rules.mk</code></li></ul></li><li><code>keyboards/top_folder/sub_1/sub_2/post_rules.mk</code></li></ul></li><li><code>keyboards/top_folder/sub_1/post_rules.mk</code></li></ul></li><li><code>keyboards/top_folder/post_rules.mk</code></li><li><code>common_features.mk</code></li></ul><p>Many of the settings written in the <code>rules.mk</code> file are interpreted by <code>common_features.mk</code>, which sets the necessary source files and compiler options.</p><p>The <code>post_rules.mk</code> file can interpret <code>features</code> of a keyboard-level before <code>common_features.mk</code>. For example, when your designed keyboard has the option to implement backlighting or underglow using rgblight.c, writing the following in the <code>post_rules.mk</code> makes it easier for the user to configure the <code>rules.mk</code>.</p><ul><li><code>keyboards/top_folder/keymaps/a_keymap/rules.mk</code><divclass="language-make vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">make</span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Please set the following according to the selection of the hardware implementation option.</span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">endif</span></span></code></pre></div></li></ul><divclass="tip custom-block"><pclass="custom-block-title">TIP</p><p>See <code>build_keyboard.mk</code> and <code>common_features.mk</code> for more details.</p></div><h3id="keyboard-name-c"tabindex="-1"><code><keyboard_name.c></code><aclass="header-anchor"href="#keyboard-name-c"aria-label="Permalink to "`<keyboard_name.c>`""></a></h3><p>This is where you will write custom code for your keyboard. Typically you will write code to initialize and interface with the hardware in your keyboard. If your keyboard consists of only a key matrix with no LEDs, speakers, or other auxiliary hardware this file can be blank.</p><p>The following functions are typically defined in this file:</p><ul><li><code>void matrix_init_kb(void)</code></li><li><code>void matrix_scan_kb(void)</code></li><li><code>bool process_record_kb(uint16_t keycode, keyrecord_t *record)</code></li><li><code>bool led_update_kb(led_t led_state)</code></li></ul><h3id="keyboard-name-h"tabindex="-1"><code><keyboard_name.h></code><aclass="header-anchor"href="#keyboard-name-h"aria-label="Permalink to "`<keyboard_name.h>`""></a></h3><p>This file is used to define the matrix for your keyboard. You should define at least one C macro which translates an array into a matrix representing the physical switch matrix for your keyboard. If it's possible to build your keyboard with multiple layouts you should define additional macros.</p><p>If you have only a single layout you should call this macro <code>LAYOUT</code>.</p><p>When defining multiple layouts you should have a base layout, named <code>LAYOUT_all</code>, that supports all possible switch positions on your matrix, even if that layout is impossible to build physically. This is the macro you should use in your <code>default</code> keymap. You should then have additional keymaps named <code>default_<layout></code> that use your other layout macros. This will make it easier for people to use the layouts you define.</p><p>Layout macro names are entirely lowercase, except for the word <code>LAYOUT</code> at the front.</p><p>As an example, if you have a 60% PCB that supports ANSI and ISO you might define the following layouts and keymaps:</p><table><thead><tr><th>Layout Name</th><th>Keymap Name</th><th>Description</th></tr></thead><tbody><tr><td>LAYOUT_all</td><td>default</td><td>A layout that supports both ISO and ANSI</td></tr><tr><td>LAYOUT_ansi</td><td>default_ansi</td><td>An ANSI layout</td></tr><tr><td>LAYOUT_iso</td><td>default_iso</td><td>An ISO layout</td></tr></tbody></table><divclass="tip custom-block"><pclass="custom-block-title">TIP</p><p>Providing only <code>LAYOUT_all</code> is invalid - especially when implementing the additional layouts within 3rd party tooling.</p></div><h2id="image-hardware-files"tabindex="-1">Image/Hardware Files <aclass="header-anchor"href="#image-hardware-files"aria-label="Permalink to "Image/Hardware Files""></a></h2><p>In an effort to keep the repo size down we're no longer accepting binary files of any format, with few exceptions. Hosting them elsewhere (such as <ahref="https://imgur.com"target="_blank"rel="noreferrer">https://imgur.com</a>) and linking them in the <code>readme.md</code> is preferred.</p><p>Hardware files (such as plates, cases, pcb) can be contributed to the <ahref="https://github.com/qmk/qmk.fm"target="_blank"rel="noreferrer">qmk.fm repo</a> and they will be made available on <ahref="https://qmk.fm"target="_blank"rel="noreferrer">qmk.fm</a>. Downloadable files are stored in <code>/<keyboard>/</code> (name follows the same format as above) which are served at <code>https://qmk.fm/<keyboard>/</code>, and pages are generated from <code>/_pages/<keyboard>/</code> which are served at the same location (.md files are generated into .html files through Jekyll). Check out the <code>lets_split</code> folder for an example.</p><h2