qmk_firmware/assets/ref_functions.md.BqUSY2Jo.js

16 lines
19 KiB
JavaScript
Raw Normal View History

import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.DyMmIvSC.js";
const __pageData = JSON.parse('{"title":"List of Useful Core Functions To Make Your Keyboard Better","description":"","frontmatter":{},"headers":[],"relativePath":"ref_functions.md","filePath":"ref_functions.md"}');
const _sfc_main = { name: "ref_functions.md" };
const _hoisted_1 = /* @__PURE__ */ createStaticVNode('<h1 id="list-of-useful-core-functions-to-make-your-keyboard-better" tabindex="-1">List of Useful Core Functions To Make Your Keyboard Better <a class="header-anchor" href="#list-of-useful-core-functions-to-make-your-keyboard-better" aria-label="Permalink to &quot;List of Useful Core Functions To Make Your Keyboard Better&quot;"></a></h1><p>There are a lot of hidden functions in QMK that are incredibly useful, or may add a bit of functionality that you&#39;ve been wanting. Functions that are specific to certain features are not included here, as those will be on their respective feature page.</p><h2 id="olkb-tri-layers" tabindex="-1">(OLKB) Tri Layers <a class="header-anchor" href="#olkb-tri-layers" aria-label="Permalink to &quot;(OLKB) Tri Layers {#olkb-tri-layers}&quot;"></a></h2><p>There are actually separate functions that you can use there, depending on what you&#39;re after.</p><h3 id="update-tri-layer-x-y-z" tabindex="-1"><code>update_tri_layer(x, y, z)</code> <a class="header-anchor" href="#update-tri-layer-x-y-z" aria-label="Permalink to &quot;`update_tri_layer(x, y, z)`&quot;"></a></h3><p>The first is the <code>update_tri_layer(x, y, z)</code> function. This function check to see if layers <code>x</code> and <code>y</code> are both on. If they are both on, then it turns on layer <code>z</code>. Otherwise, if both <code>x</code> and <code>y</code> are not both on (either only one is, or neither is), then it turns off layer <code>z</code>.</p><p>This function is useful if you want to create specific keys that have this functionality, but other layer keycodes won&#39;t do this.</p><h4 id="example" tabindex="-1">Example <a class="header-anchor" href="#example" aria-label="Permalink to &quot;Example&quot;"></a></h4><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;">bool</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> process_record_user</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">uint16_t</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> keycode</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">keyrecord_t</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> *</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">record</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) {</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> switch</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (keycode) {</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> case</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> LOWER:</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (record</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">-&gt;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">event.pressed) {</span></span>\n<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> layer_on</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(_LOWER);</span></span>\n<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> update_tri_layer</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(_LOWER, _RAISE, _ADJUST);</span></span>\n<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">else</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>\n<span class="line"><span style="--shiki-light
const _hoisted_39 = [
_hoisted_1
];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, _hoisted_39);
}
const ref_functions = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
__pageData,
ref_functions as default
};