</code></pre><p>and this to your <code>config.h</code>:</p><divclass="language-c vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">c</span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// Connects each switch in the dip switch to the GPIO pin of the MCU</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// For split keyboards, you can separately define the right side pins</span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> DIP_SWITCH_PINS_RIGHT</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { ... }</span></span></code></pre></div><p>or</p><divclass="language-c vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">c</span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// Connect each switch in the DIP switch to an unused intersections in the key matrix.</span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">#define</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> DIP_SWITCH_MATRIX_GRID</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> { {</span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">0</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">6</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}, {</span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">6</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}, {</span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">2</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">6</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">} }</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // List of row and col pairs</span></span></code></pre></div><h2id="dip-switch-map"tabindex="-1">DIP Switch map <aclass="header-anchor"href="#dip-switch-map"aria-label="Permalink to "DIP Switch map {#dip-switch-map}""></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's <code>rules.mk</code>:</p><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:#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><divclass="language-c vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">c</span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">#if</span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;"> defined</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">DIP_SWITCH_MAP_ENABLE</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">#endif</span></span></code></pre></div><divclass="tip custom-block"><pclass="custom-block-title">TIP</p><p>This should only be enabled at the keymap level.</p></div><h2id="callbacks"tabindex="-1">Callbacks <aclass="header-anchor"href="#callbacks"aria-label="Permalink to "Callbacks""></a></h2><p>The callback functions can be inserted into your <code><keyboard>.c</code>:</p><divclass="language-c vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">c</span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">bool</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> dip_switch_update_kb</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">uint8_t</span><spanstyle="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> index</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">bool</span><spanstyle="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> active</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) { </span></span>
<spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>Additionally, we support bit mask functions which allow for more complex handling.</p><divclass="language-c vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">c</span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">bool</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> dip_switch_update_mask_kb</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">uint32_t</span><spanstyle="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> state</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) { </span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (state </span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">&</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (</span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1</span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">UL<<</span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">0</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) </span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">&&</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> state </span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">&</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> (</span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1</span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">UL<<</span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">1</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)) {</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> layer_on</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(_ADJUST);</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // C on esc</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> layer_on</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(_TEST_A);</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // A on ESC</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> layer_on</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(_TEST_B);</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // B on esc</span></span>
<spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h2id="hardware"tabindex="-1">Hardware <aclass="header-anchor"href="#hardware"aria-label="Permalink to "Hardware""></a></h2><h3id="connects-each-switch-in-the-dip-switch-to-the-gpio-pin-of-the-mcu"tabindex="-1">Connects each switch in the dip switch to the GPIO pin of the MCU <aclass="header-anchor"href="#connects-each-switch-in-the-dip-switch-to-the-gpio-pin-of-the-mcu"aria-label="Permalink to "Connects each switch in the dip switch to the GPIO pin of the MCU""></a></h3><p>One side of the DIP switch should be wired directly to the pin on the MCU, and the other side to ground. It should not matter which side is connected to which, as it should be functionally the same.</p><h3id="connect-each-switch-in-the-dip-switch-to-an-unused-intersections-in-the-key-matrix"tabindex="-1">Connect each switch in the DIP switch to an unused intersections in the key matrix. <aclass="header-anchor"href="#connect-each-switch-in-the-dip-switch-to-an-unused-intersections-in-the-key-matrix"aria-label="Permalink to "Connect each switch in the DIP switch to an unused intersections in the key matrix.""></a></h3><p>As with the keyswitch, a diode and DIP switch connect the ROW line to the COL line.</p></div></div></main><footerclass="VPDocFooter"data-v-39a288b8data-v-09de1c0f><!--[--><!--]--><!----><navclass="prev-next"data-v-09de1c0f><divclass="pager"data-v-09de1c0f><aclass="VPLink link pager-link prev"href="/custom_matrix"data-v-09de1c0f><!--[--><spanclass="desc"data-v-09de1c0f>Previous page</span><spanclass="title"data-v-09de1c0f>Custom Matrix</span><!--]--></a></div><divclass="pager"data-v-09de1c0f><aclass="VPLink link pager-link next"href="/features/encoders"data-v-09de1c0f><!--[--><spanclass="desc"data-v-09de1c0f>Next page</span><spanclass="title"data-v-09de1c0f>Encoders</span><!--]--></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>