aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2021-08-20 10:15:11 +0100
committerGitHub <noreply@github.com>2021-08-20 10:15:11 +0100
commit69c71d4843586fad9c29c4dd945aa170f9990d8e (patch)
tree4385200dc75fc6090f36ff3038d2fa0c996600cc
parentb229b0fba72d79f1c723f2415531e61537b56fc3 (diff)
downloadqmk_firmware-69c71d4843586fad9c29c4dd945aa170f9990d8e.tar.gz
qmk_firmware-69c71d4843586fad9c29c4dd945aa170f9990d8e.zip
Align DIP_SWITCH_PINS_RIGHT implementation with encoders (#14079)
-rw-r--r--quantum/dip_switch.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/quantum/dip_switch.c b/quantum/dip_switch.c
index 2608cae59..133ec8502 100644
--- a/quantum/dip_switch.c
+++ b/quantum/dip_switch.c
@@ -35,9 +35,6 @@
35#ifdef DIP_SWITCH_PINS 35#ifdef DIP_SWITCH_PINS
36# define NUMBER_OF_DIP_SWITCHES (sizeof(dip_switch_pad) / sizeof(pin_t)) 36# define NUMBER_OF_DIP_SWITCHES (sizeof(dip_switch_pad) / sizeof(pin_t))
37static pin_t dip_switch_pad[] = DIP_SWITCH_PINS; 37static pin_t dip_switch_pad[] = DIP_SWITCH_PINS;
38# if defined(SPLIT_KEYBOARD) && defined(DIP_SWITCH_PINS_RIGHT)
39static pin_t dip_switch_pad_right[] = DIP_SWITCH_PINS_RIGHT;
40# endif
41#endif 38#endif
42 39
43#ifdef DIP_SWITCH_MATRIX_GRID 40#ifdef DIP_SWITCH_MATRIX_GRID
@@ -65,16 +62,16 @@ __attribute__((weak)) bool dip_switch_update_mask_kb(uint32_t state) { return di
65 62
66void dip_switch_init(void) { 63void dip_switch_init(void) {
67#ifdef DIP_SWITCH_PINS 64#ifdef DIP_SWITCH_PINS
68 for (uint8_t i = 0; i < NUMBER_OF_DIP_SWITCHES; i++) {
69# if defined(SPLIT_KEYBOARD) && defined(DIP_SWITCH_PINS_RIGHT) 65# if defined(SPLIT_KEYBOARD) && defined(DIP_SWITCH_PINS_RIGHT)
70 if (isLeftHand) { 66 if (!isLeftHand) {
71# endif 67 const pin_t dip_switch_pad_right[] = DIP_SWITCH_PINS_RIGHT;
72 setPinInputHigh(dip_switch_pad[i]); 68 for (uint8_t i = 0; i < NUMBER_OF_DIP_SWITCHES; i++) {
73# if defined(SPLIT_KEYBOARD) && defined(DIP_SWITCH_PINS_RIGHT) 69 dip_switch_pad[i] = dip_switch_pad_right[i];
74 } else {
75 setPinInputHigh(dip_switch_pad_right[i]);
76 } 70 }
71 }
77# endif 72# endif
73 for (uint8_t i = 0; i < NUMBER_OF_DIP_SWITCHES; i++) {
74 setPinInputHigh(dip_switch_pad[i]);
78 } 75 }
79 dip_switch_read(true); 76 dip_switch_read(true);
80#endif 77#endif
@@ -103,15 +100,7 @@ void dip_switch_read(bool forced) {
103 100
104 for (uint8_t i = 0; i < NUMBER_OF_DIP_SWITCHES; i++) { 101 for (uint8_t i = 0; i < NUMBER_OF_DIP_SWITCHES; i++) {
105#ifdef DIP_SWITCH_PINS 102#ifdef DIP_SWITCH_PINS
106# if defined(SPLIT_KEYBOARD) && defined(DIP_SWITCH_PINS_RIGHT) 103 dip_switch_state[i] = !readPin(dip_switch_pad[i]);
107 if (isLeftHand) {
108# endif
109 dip_switch_state[i] = !readPin(dip_switch_pad[i]);
110# if defined(SPLIT_KEYBOARD) && defined(DIP_SWITCH_PINS_RIGHT)
111 } else {
112 dip_switch_state[i] = !readPin(dip_switch_pad_right[i]);
113 }
114# endif
115#endif 104#endif
116#ifdef DIP_SWITCH_MATRIX_GRID 105#ifdef DIP_SWITCH_MATRIX_GRID
117 dip_switch_state[i] = peek_matrix(dip_switch_pad[i].row, dip_switch_pad[i].col, read_raw); 106 dip_switch_state[i] = peek_matrix(dip_switch_pad[i].row, dip_switch_pad[i].col, read_raw);