summaryrefslogtreecommitdiff
path: root/keyboards
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2023-12-11 23:06:18 +0000
committerGitHub <noreply@github.com>2023-12-11 23:06:18 +0000
commit4682226e20d17437c0a6f67f5d6160432074d948 (patch)
tree94a85cb8b8ae55c8f3db7ab09d8af13d66bf0bfa /keyboards
parentd85f954d3065da06e0c7eb14068d61f18b23bd25 (diff)
Keymap introspection for Dip Switches (#22543)
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/handwired/onekey/keymaps/dip_switch_map/config.h6
-rw-r--r--keyboards/handwired/onekey/keymaps/dip_switch_map/keymap.c14
-rw-r--r--keyboards/handwired/onekey/keymaps/dip_switch_map/rules.mk2
3 files changed, 22 insertions, 0 deletions
diff --git a/keyboards/handwired/onekey/keymaps/dip_switch_map/config.h b/keyboards/handwired/onekey/keymaps/dip_switch_map/config.h
new file mode 100644
index 0000000000..7e5b6c0b91
--- /dev/null
+++ b/keyboards/handwired/onekey/keymaps/dip_switch_map/config.h
@@ -0,0 +1,6 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+#pragma once
+
+// TODO: Remove reuse of pin
+#define DIP_SWITCH_PINS { WS2812_DI_PIN }
diff --git a/keyboards/handwired/onekey/keymaps/dip_switch_map/keymap.c b/keyboards/handwired/onekey/keymaps/dip_switch_map/keymap.c
new file mode 100644
index 0000000000..35bb16d458
--- /dev/null
+++ b/keyboards/handwired/onekey/keymaps/dip_switch_map/keymap.c
@@ -0,0 +1,14 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ [0] = LAYOUT_ortho_1x1(KC_A),
+ [1] = LAYOUT_ortho_1x1(KC_B),
+};
+
+#if defined(DIP_SWITCH_MAP_ENABLE)
+const uint16_t PROGMEM dip_switch_map[NUM_DIP_SWITCHES][NUM_DIP_STATES] = {
+ DIP_SWITCH_OFF_ON(DF(0), DF(1))
+};
+#endif
diff --git a/keyboards/handwired/onekey/keymaps/dip_switch_map/rules.mk b/keyboards/handwired/onekey/keymaps/dip_switch_map/rules.mk
new file mode 100644
index 0000000000..b2429854f1
--- /dev/null
+++ b/keyboards/handwired/onekey/keymaps/dip_switch_map/rules.mk
@@ -0,0 +1,2 @@
+DIP_SWITCH_ENABLE = yes
+DIP_SWITCH_MAP_ENABLE = yes