mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-18 21:52:02 +00:00
16 lines
32 KiB
JavaScript
16 lines
32 KiB
JavaScript
import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.Cauyuiy8.js";
|
||
const __pageData = JSON.parse('{"title":"QMK Keyboard Guidelines","description":"","frontmatter":{},"headers":[],"relativePath":"hardware_keyboard_guidelines.md","filePath":"hardware_keyboard_guidelines.md","lastUpdated":null}');
|
||
const _sfc_main = { name: "hardware_keyboard_guidelines.md" };
|
||
const _hoisted_1 = /* @__PURE__ */ createStaticVNode('<h1 id="qmk-keyboard-guidelines" tabindex="-1">QMK Keyboard Guidelines <a class="header-anchor" href="#qmk-keyboard-guidelines" aria-label="Permalink to "QMK Keyboard Guidelines""></a></h1><p>Since starting, QMK has grown by leaps and bounds thanks to people like you who contribute to creating and maintaining our community keyboards. As we've grown we've discovered some patterns that work well, and ask that you conform to them to make it easier for other people to benefit from your hard work.</p><h2 id="use-qmk-lint" tabindex="-1">Use QMK Lint <a class="header-anchor" href="#use-qmk-lint" aria-label="Permalink to "Use QMK Lint""></a></h2><p>We have provided a tool, <code>qmk lint</code>, which will let you check over your keyboard for problems. We suggest using it frequently while working on your keyboard and keymap.</p><p>Example passing check:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span>$ qmk lint -kb rominronin/katana60/rev2</span></span>\n<span class="line"><span>Ψ Lint check passed!</span></span></code></pre></div><p>Example failing check:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span>$ qmk lint -kb clueboard/66/rev3</span></span>\n<span class="line"><span>☒ Missing keyboards/clueboard/66/rev3/readme.md</span></span>\n<span class="line"><span>☒ Lint check failed!</span></span></code></pre></div><h2 id="naming-your-keyboard-project" tabindex="-1">Naming Your Keyboard/Project <a class="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><h2 id="sub-folders" tabindex="-1">Sub-folders <a class="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><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="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>keyboard.json</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>keyboard.json</code> file.</p><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>When configuring a keyboard with multiple revisions (like the <code>clueboard/66</code> example below), an <code>info.json</code> file at the top keyboard level (eg. <code>clueboard/66</code>) should be used for configuration shared between revisions. Then <code>keyboard.json</code> in each revision directory containing revision-specific configuration, and indicating a buildable keyboard.</p></div><p>Example:</p><p>Clueboard uses sub-folders for both purposes, organization and keyboard revisions.</p><ul><li><a href="https://github.com/qmk/qmk_firmware/tree/master" target="_blank" rel="noreferrer"><code>qmk_firmware</code></a><ul><li><a href="https://github.com/qmk/qmk_firmware/tree/master/keyboards" target="_blank" rel="noreferrer"><code>keyboards</code></a><ul><li><a href="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>keyboard.json</code> file <ul><li><a href="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>keyboard.json</code> file</li><li><a href="https://github.com/qmk/qmk_firmware/tree/master/keyboards/clueboard/66" target="_blank" rel="noreferrer"><code>66</code></a> ← This is not a compilable keyboard - a revision must be specified <ul><li><a href="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><a href="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><a href="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></li></ul></li></ul></li></ul></li></ul></li></ul><h2 id="keyboard-folder-structure" tabindex="-1">Keyboard Folder Structure <a class="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, some of which are optional:</p><ul><li><code>readme.md</code></li><li><code>keyboard.json</code> (or <code>info.json</code>)</li><li><code>config.h</code></li><li><code>rules.mk</code></li><li><code><keyboard_name>.c</code></li><li><code><keyboard_name>.h</code></li></ul><h3 id="readme-md" tabindex="-1"><code>readme.md</code> <a class="header-anchor" href="#readme-md" aria-label="Permalink to "`readme.md`""></a></h3><p>All projects need to have a <code>readme.md</code> file that explains what the keyboard is, who made it and where it's available. If applicable, it should also contain links to more information, such as the maker's website. Please follow the <a href="./documentation_templates#keyboard-readmemd-template">published template</a>.</p><h3 id="keyboard-json-info-json" tabindex="-1"><code>keyboard.json</code>/<code>info.json</code> <a class="header-anchor" href="#keyboard-json-info-json" aria-label="Permalink to "`keyboard.json`/`info.json`""></a></h3><p>The <code>keyboard.json</code> file is necessary for your keyboard (or keyboard revision) to be considered a buildable keyboard. The same content is valid in both <code>info.json</code> and <code>keyboard.json</code>. For the available configuration options of this file, see the <a href="./reference_info_json">reference page</a>. This file is also used by the <a href="https://github.com/qmk/qmk_api" target="_blank" rel="noreferrer">QMK API</a>, and by the <a href="https://config.qmk.fm/" target="_blank" rel="noreferrer">QMK Configurator</a> to display a representation of the available layouts of your keyboard.</p><p>Additionally, this is where layouts available on your keyboard are defined. If you only have a single layout, it should be named <code>LAYOUT</code>. When defining multiple layouts, you should have a base layout, named <code>LAYOUT_all</code>, that supports all possible switch positions in your matrix, even if that layout is impossible to build physically. This is the layout that should be used in the <code>default</code> keymap. You should then have additional keymaps named <code>default_<layout></code> that configure keymaps for the other layouts. Layout macro names are entirely lowercase, except for the prefix of <code>LAYOUT</code>.</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><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>Providing only <code>LAYOUT_all</code> is invalid, as is providing a <code>LAYOUT</code> when multiple layouts are present.</p></div><h3 id="config-h" tabindex="-1"><code>config.h</code> <a class="header-anchor" href="#config-h" aria-label="Permalink to "`config.h`""></a></h3><p>Some projects will need to have a <code>config.h</code> that configures parameters that are not possible to be set in <code>keyboard.json</code>. This is not a required file.</p><p>The <code>config.h</code> files can also be placed in sub-folders, and the order in which they are read is as follows:</p><ul><li><code>keyboards/top_folder/config.h</code><ul><li><code>keyboards/top_folder/sub_1/config.h</code><ul><li><code>keyboards/top_folder/sub_1/sub_2/config.h</code><ul><li><code>keyboards/top_folder/sub_1/sub_2/sub_3/config.h</code><ul><li><code>keyboards/top_folder/sub_1/sub_2/sub_3/sub_4/config.h</code><ul><li><a href="./data_driven_config#add-code-to-generate-it"><code>.build/objs_<keyboard>/src/info_config.h</code></a> see <a href="./data_driven_config">Data Driven Configuration</a></li><li><code>users/a_user_folder/config.h</code></li><li><code>keyboards/top_folder/keymaps/a_keymap/config.h</code></li></ul></li><li><code>keyboards/top_folder/sub_1/sub_2/sub_3/sub_4/post_config.h</code></li></ul></li><li><code>keyboards/top_folder/sub_1/sub_2/sub_3/post_config.h</code></li></ul></li><li><code>keyboards/top_folder/sub_1/sub_2/post_config.h</code></li></ul></li><li><code>keyboards/top_folder/sub_1/post_config.h</code></li></ul></li><li><code>keyboards/top_folder/post_config.h</code></li></ul><p>The <code>post_config.h</code> file can be used for additional post-processing, depending on what is specified in the <code>config.h</code> file. For example, if you define the <code>IOS_DEVICE_ENABLE</code> macro in your keymap-level <code>config.h</code> file as follows, you can configure more detailed settings accordingly in the <code>post_config.h</code> file:</p><ul><li><code>keyboards/top_folder/keymaps/a_keymap/config.h</code><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> IOS_DEVICE_ENABLE</span></span></code></pre></div></li><li><code>keyboards/top_folder/post_config.h</code><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#ifndef</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> IOS_DEVICE_ENABLE</span></span>\n<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // USB_MAX_POWER_CONSUMPTION value for this keyboard</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> #define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> USB_MAX_POWER_CONSUMPTION</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 400</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#else</span></span>\n<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // fix iPhone and iPad power adapter issue</span></span>\n<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // iOS devices need less than 100</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> #define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> USB_MAX_POWER_CONSUMPTION</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 100</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#endif</span></span>\n<span class="line"></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#ifdef</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_ENABLE</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> #ifndef</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> IOS_DEVICE_ENABLE</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> #define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_LIMIT_VAL</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 200</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> #define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_VAL_STEP</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 17</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> #else</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> #define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_LIMIT_VAL</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 35</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> #define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_VAL_STEP</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 4</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> #endif</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> #ifndef</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_HUE_STEP</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> #define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_HUE_STEP</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 10</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> #endif</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> #ifndef</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_SAT_STEP</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> #define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> RGBLIGHT_SAT_STEP</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 17</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> #endif</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#endif</span></span></code></pre></div></li></ul><div class="tip custom-block"><p class="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><h3 id="rules-mk" tabindex="-1"><code>rules.mk</code> <a class="header-anchor" href="#rules-mk" aria-label="Permalink to "`rules.mk`""></a></h3><p>This file is typically used to configure hardware drivers (eg. pointing device), or to include additional C files in compilation. This is not a required file.</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><div class="language-make vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">make</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Please set the following according to the selection of the hardware implementation option.</span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">RGBLED_OPTION_TYPE = backlight </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">## none, backlight or underglow</span></span></code></pre></div></li><li><code>keyboards/top_folder/post_rules.mk</code><div class="language-make vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">make</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">ifeq</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">$(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">filter</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> $(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">strip</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> $(</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">RGBLED_OPTION_TYPE</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">))x, nonex backlightx underglowx x)</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,)</span></span>\n<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> $(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">error</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> unknown RGBLED_OPTION_TYPE value "$(</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">RGBLED_OPTION_TYPE</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">)")</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">endif</span></span>\n<span class="line"></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">ifeq</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">$(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">strip</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> $(</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">RGBLED_OPTION_TYPE</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">))</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,backlight)</span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> RGBLIGHT_ENABLE = yes</span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> OPT_DEFS += -DRGBLIGHT_LED_COUNT=30</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">endif</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">ifeq</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">$(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">strip</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> $(</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">RGBLED_OPTION_TYPE</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">))</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,underglow)</span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> RGBLIGHT_ENABLE = yes</span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> OPT_DEFS += -DRGBLIGHT_LED_COUNT=6</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">endif</span></span></code></pre></div></li></ul><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>See <code>build_keyboard.mk</code> and <code>common_features.mk</code> for more details.</p></div><h3 id="keyboard-name-c" tabindex="-1"><code><keyboard_name.c></code> <a class="header-anchor" href="#keyboard-name-c" aria-label="Permalink to "`<keyboard_name.c>`""></a></h3><p>This file should contain C code required for the functionality of your keyboard, for example hardware initialisation code, OLED display code, and so on. This file should only contain code necessary for the keyboard to work, and <em>not</em> things that should be left to the end user to configure in their keymap. This file is automatically included in compilation if it exists. This is not a required file.</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><h3 id="keyboard-name-h" tabindex="-1"><code><keyboard_name.h></code> <a class="header-anchor" href="#keyboard-name-h" aria-label="Permalink to "`<keyboard_name.h>`""></a></h3><p>This file can contain function prototypes for custom functions and other header file code utilised by <code><keyboard_name>.c</code>. The <code><keyboard_name>.c</code> file should include this file. This is not a required file.</p><h2 id="image-hardware-files" tabindex="-1">Image/Hardware Files <a class="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 do not accept binary files of any format, with few exceptions. Hosting them elsewhere (such as <a href="https://imgur.com" target="_blank" rel="noreferrer">https://imgur.com</a>) and linking them in the <code>readme.md</code> is preferred. Hardware files such as plates, cases, and PCBs can be published in a personal repository or elsewhere, and linked to by your keyboard's <code>readme.md</code> file.</p><h2 id="keyboard-defaults" tabindex="-1">Keyboard Defaults <a class="header-anchor" href="#keyboard-defaults" aria-label="Permalink to "Keyboard Defaults""></a></h2><p>Given the amount of functionality that QMK exposes it's very easy to confuse new users. When putting together the default firmware for your keyboard we recommend limiting your enabled features and options to the minimal set needed to support your hardware. Recommendations for specific features follow.</p><h3 id="magic-keycodes-and-command" tabindex="-1">Magic Keycodes and Command <a class="header-anchor" href="#magic-keycodes-and-command" aria-label="Permalink to "Magic Keycodes and Command""></a></h3><p><a href="./keycodes_magic">Magic Keycodes</a> and <a href="./features/command">Command</a> are two related features that allow a user to control their keyboard in non-obvious ways. We recommend you think long and hard about if you're going to enable either feature, and how you will expose this functionality. Keep in mind that users who want this functionality can enable it in their personal keymaps without affecting all the novice users who may be using your keyboard as their first programmable board.</p><p>If your keyboard does not have 2 shift keys you should provide a working default for <code>IS_COMMAND</code>, even when you have set <code>COMMAND_ENABLE = no</code>. This will give your users a default to conform to if they do enable Command.</p><h2 id="custom-keyboard-programming" tabindex="-1">Custom Keyboard Programming <a class="header-anchor" href="#custom-keyboard-programming" aria-label="Permalink to "Custom Keyboard Programming""></a></h2><p>As documented on <a href="./custom_quantum_functions">Customizing Functionality</a> you can define custom functions for your keyboard. Please keep in mind that your users may want to customize that behavior as well, and make it possible for them to do that. If you are providing a custom function, for example <code>process_record_kb()</code>, make sure that your function calls the <code>_user()</code> version of the call too. You should also take into account the return value of the <code>_user()</code> version, and only run your custom code if the user returns <code>true</code>.</p><h2 id="non-production-handwired-projects" tabindex="-1">Non-Production/Handwired Projects <a class="header-anchor" href="#non-production-handwired-projects" aria-label="Permalink to "Non-Production/Handwired Projects""></a></h2><p>We're happy to accept any project that uses QMK, including handwired ones, but we have a separate <code>/keyboards/handwired/</code> folder for them, so the main <code>/keyboards/</code> folder doesn't get overcrowded. If a prototype project becomes a production project at some point in the future, we'd be happy to move it to the main <code>/keyboards/</code> folder!</p><h2 id="warnings-as-errors" tabindex="-1">Warnings as Errors <a class="header-anchor" href="#warnings-as-errors" aria-label="Permalink to "Warnings as Errors""></a></h2><p>When developing your keyboard, keep in mind that all warnings will be treated as errors - these small warnings can build-up and cause larger errors down the road (and keeping them is generally a bad practice).</p><h2 id="copyright-blurb" tabindex="-1">Copyright Blurb <a class="header-anchor" href="#copyright-blurb" aria-label="Permalink to "Copyright Blurb""></a></h2><p>If you're adapting your keyboard's setup from another project, but not using the same code, be sure to update the copyright header at the top of the files to show your name, in this format:</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Copyright </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2017</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> Your Name </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">your@email.com</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">></span></span></code></pre></div><p>If you are modifying someone else's code and have made only trivial changes you should leave their name in the copyright statement. If you have done significant work on the file you should add your name to theirs, like so:</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Copyright </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2017</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> Their Name </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">original_author@example.com</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> Your Name </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">you@example.com</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">></span></span></code></pre></div><p>The year should be the first year the file is created. If work was done to that file in later years you can reflect that by appending the second year to the first, like so:</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</span><pre class="shiki shiki-themes github-light github-dark vp-code"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">Copyright </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2015</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2017</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> Your Name </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">you@example.com</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">></span></span></code></pre></div><h2 id="license" tabindex="-1">License <a class="header-anchor" href="#license" aria-label="Permalink to "License""></a></h2><p>The core of QMK is licensed under the <a href="https://www.gnu.org/licenses/licenses.en.html" target="_blank" rel="noreferrer">GNU General Public License</a>. If you are shipping binaries for AVR processors you may choose either <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html" target="_blank" rel="noreferrer">GPLv2</a> or <a href="https://www.gnu.org/licenses/gpl.html" target="_blank" rel="noreferrer">GPLv3</a>. If you are shipping binaries for ARM processors you must choose <a href="https://www.gnu.org/licenses/gpl.html" target="_blank" rel="noreferrer">GPL Version 3</a> to comply with the <a href="https://www.chibios.org" target="_blank" rel="noreferrer">ChibiOS</a> GPLv3 license.</p>', 75);
|
||
const _hoisted_76 = [
|
||
_hoisted_1
|
||
];
|
||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||
return openBlock(), createElementBlock("div", null, _hoisted_76);
|
||
}
|
||
const hardware_keyboard_guidelines = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||
export {
|
||
__pageData,
|
||
hardware_keyboard_guidelines as default
|
||
};
|