qmk_firmware/assets/features_dip_switch.md.DQ7jEipz.js

16 lines
24 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":"DIP Switches","description":"","frontmatter":{},"headers":[],"relativePath":"features/dip_switch.md","filePath":"features/dip_switch.md"}');
const _sfc_main = { name: "features/dip_switch.md" };
const _hoisted_1 = /* @__PURE__ */ createStaticVNode('<h1 id="dip-switches" tabindex="-1">DIP Switches <a class="header-anchor" href="#dip-switches" aria-label="Permalink to &quot;DIP Switches&quot;"></a></h1><p>DIP switches are supported by adding this to your <code>rules.mk</code>:</p><pre><code>DIP_SWITCH_ENABLE = yes\n</code></pre><p>and this to your <code>config.h</code>:</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:#6A737D;--shiki-dark:#6A737D;">// Connects each switch in the dip switch to the GPIO pin of the MCU</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> DIP_SWITCH_PINS</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { B14, A15, A10, B9 }</span></span>\n<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// For split keyboards, you can separately define the right side pins</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> DIP_SWITCH_PINS_RIGHT</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { ... }</span></span></code></pre></div><p>or</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:#6A737D;--shiki-dark:#6A737D;">// Connect each switch in the DIP switch to an unused intersections in the key matrix.</span></span>\n<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> DIP_SWITCH_MATRIX_GRID</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">6</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}, {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">6</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}, {</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">6</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">} }</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // List of row and col pairs</span></span></code></pre></div><h2 id="dip-switch-map" tabindex="-1">DIP Switch map <a class="header-anchor" href="#dip-switch-map" aria-label="Permalink to &quot;DIP Switch map {#dip-switch-map}&quot;"></a></h2><p>DIP Switch mapping may be added to your <code>keymap.c</code>, which replicates the normal keyswitch functionality, but with dip switches. Add this to your keymap&#39;s <code>rules.mk</code>:</p><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:#24292E;--shiki-dark:#E1E4E8;">DIP_SWITCH_MAP_ENABLE = yes</span></span></code></pre></div><p>Your <code>keymap.c</code> will then need a dip switch mapping defined (for two dip switches):</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:#D73A49;--shiki-dark:#F97583;">#if</span><span style="--shiki
const _hoisted_28 = [
_hoisted_1
];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("div", null, _hoisted_28);
}
const dip_switch = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
__pageData,
dip_switch as default
};