qmk_firmware/assets/keymap.md.CdrmoAZr.js

16 lines
29 KiB
JavaScript
Raw Normal View History

import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.B9AX-CPi.js";
const __pageData = JSON.parse('{"title":"Keymap Overview","description":"","frontmatter":{},"headers":[],"relativePath":"keymap.md","filePath":"keymap.md"}');
const _sfc_main = { name: "keymap.md" };
const _hoisted_1 = /* @__PURE__ */ createStaticVNode('<h1 id="keymap-overview" tabindex="-1">Keymap Overview <a class="header-anchor" href="#keymap-overview" aria-label="Permalink to &quot;Keymap Overview&quot;"></a></h1><p>QMK keymaps are defined inside a C source file. The data structure is an array of arrays. The outer array is a list of layer arrays while the inner layer array is a list of keys. Most keyboards define a <code>LAYOUT()</code> macro to help you create this array of arrays.</p><h2 id="keymap-and-layers" tabindex="-1">Keymap and Layers <a class="header-anchor" href="#keymap-and-layers" aria-label="Permalink to &quot;Keymap and Layers {#keymap-and-layers}&quot;"></a></h2><p>In QMK, <strong><code>const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS]</code></strong> holds multiple <strong>layers</strong> of keymap information in <strong>16 bit</strong> data holding the <strong>action code</strong>. You can define <strong>32 layers</strong> at most.</p><p>For trivial key definitions, the higher 8 bits of the <strong>action code</strong> are all 0 and the lower 8 bits holds the USB HID usage code generated by the key as <strong>keycode</strong>.</p><p>Respective layers can be validated simultaneously. Layers are indexed with 0 to 31 and higher layer has precedence.</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>Keymap: 32 Layers Layer: action code matrix</span></span>\n<span class="line"><span>----------------- ---------------------</span></span>\n<span class="line"><span>stack of layers array_of_action_code[row][column]</span></span>\n<span class="line"><span> ____________ precedence _______________________</span></span>\n<span class="line"><span> / / | high / ESC / F1 / F2 / F3 ....</span></span>\n<span class="line"><span> 31 /___________// | /-----/-----/-----/-----</span></span>\n<span class="line"><span> 30 /___________// | / TAB / Q / W / E ....</span></span>\n<span class="line"><span> 29 /___________/ | /-----/-----/-----/-----</span></span>\n<span class="line"><span> : _:_:_:_:_:__ | : /LCtrl/ A / S / D ....</span></span>\n<span class="line"><span> : / : : : : : / | : / : : : :</span></span>\n<span class="line"><span> 2 /___________// | 2 `--------------------------</span></span>\n<span class="line"><span> 1 /___________// | 1 `--------------------------</span></span>\n<span class="line"><span> 0 /___________/ V low 0 `--------------------------</span></span></code></pre></div><p>Sometimes, the action code stored in keymap may be referred as keycode in some documents due to the TMK history.</p><h3 id="keymap-layer-status" tabindex="-1">Keymap Layer Status <a class="header-anchor" href="#keymap-layer-status" aria-label="Permalink to &quot;Keymap Layer Status {#keymap-layer-status}&quot;"></a></h3><p>The state of the Keymap layer is determined by two 32 bit parameters:</p><ul><li><strong><code>default_layer_state</code></strong> indicates a base keymap layer (0-31) which is always valid and to be referred (the default layer).</li><li><strong><code>layer_state</code></strong> has current on/off status of each layer in its bits.</li></ul><p>Keymap layer &#39;0&#39; is usually the <code>default_layer</code>, with other layers initially off after booting up the firmware, although this can configured differently in <code>config.h</code>. It is useful to change <code>default_layer</code> when you completely switch a key layout, for example, if you want to switch to Colemak instead of Qwerty.</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
const _hoisted_52 = [
_hoisted_1
];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, _hoisted_52);
}
const keymap = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
__pageData,
keymap as default
};