summaryrefslogtreecommitdiff
path: root/quantum/keymap_introspection.c
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 /quantum/keymap_introspection.c
parentd85f954d3065da06e0c7eb14068d61f18b23bd25 (diff)
Keymap introspection for Dip Switches (#22543)
Diffstat (limited to 'quantum/keymap_introspection.c')
-rw-r--r--quantum/keymap_introspection.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/quantum/keymap_introspection.c b/quantum/keymap_introspection.c
index e4a01d2e9a..71e3b429ea 100644
--- a/quantum/keymap_introspection.c
+++ b/quantum/keymap_introspection.c
@@ -72,6 +72,24 @@ __attribute__((weak)) uint16_t keycode_at_encodermap_location(uint8_t layer_num,
#endif // defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Dip Switch mapping
+
+#if defined(DIP_SWITCH_ENABLE) && defined(DIP_SWITCH_MAP_ENABLE)
+
+uint16_t keycode_at_dip_switch_map_location_raw(uint8_t switch_idx, bool on) {
+ if (switch_idx < NUM_DIP_SWITCHES) {
+ return pgm_read_word(&dip_switch_map[switch_idx][!!on]);
+ }
+ return KC_TRNS;
+}
+
+uint16_t keycode_at_dip_switch_map_location(uint8_t switch_idx, bool on) {
+ return keycode_at_dip_switch_map_location_raw(switch_idx, on);
+}
+
+#endif // defined(DIP_SWITCH_ENABLE) && defined(DIP_SWITCH_MAP_ENABLE)
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Combos
#if defined(COMBO_ENABLE)