diff options
| author | Nick Brassel <nick@tzarc.org> | 2021-08-29 08:20:25 +1000 |
|---|---|---|
| committer | Nick Brassel <nick@tzarc.org> | 2021-08-29 08:20:25 +1000 |
| commit | f061ca497464fe85284906fb163a33eaee7a91ef (patch) | |
| tree | 33ef1bfb529aed382e8526c607c4e18717f92571 /quantum/dip_switch.c | |
| parent | ff65185dec6f97be1eb49f17cea526a0d0bbf3d6 (diff) | |
| parent | 4bad375d7c09d949a9dcdd4feba147c9c7a67ec6 (diff) | |
Breaking changes develop merge to master, 2021Q3 edition. (#14196)
Diffstat (limited to 'quantum/dip_switch.c')
| -rw-r--r-- | quantum/dip_switch.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/quantum/dip_switch.c b/quantum/dip_switch.c index cda69bd0ef..133ec85027 100644 --- a/quantum/dip_switch.c +++ b/quantum/dip_switch.c @@ -17,6 +17,9 @@ */ #include "dip_switch.h" +#ifdef SPLIT_KEYBOARD +# include "split_common/split_util.h" +#endif // for memcpy #include <string.h> @@ -49,16 +52,24 @@ static uint16_t scan_count; static bool dip_switch_state[NUMBER_OF_DIP_SWITCHES] = {0}; static bool last_dip_switch_state[NUMBER_OF_DIP_SWITCHES] = {0}; -__attribute__((weak)) void dip_switch_update_user(uint8_t index, bool active) {} +__attribute__((weak)) bool dip_switch_update_user(uint8_t index, bool active) { return true; } -__attribute__((weak)) void dip_switch_update_kb(uint8_t index, bool active) { dip_switch_update_user(index, active); } +__attribute__((weak)) bool dip_switch_update_kb(uint8_t index, bool active) { return dip_switch_update_user(index, active); } -__attribute__((weak)) void dip_switch_update_mask_user(uint32_t state) {} +__attribute__((weak)) bool dip_switch_update_mask_user(uint32_t state) { return true; } -__attribute__((weak)) void dip_switch_update_mask_kb(uint32_t state) { dip_switch_update_mask_user(state); } +__attribute__((weak)) bool dip_switch_update_mask_kb(uint32_t state) { return dip_switch_update_mask_user(state); } void dip_switch_init(void) { #ifdef DIP_SWITCH_PINS +# if defined(SPLIT_KEYBOARD) && defined(DIP_SWITCH_PINS_RIGHT) + if (!isLeftHand) { + const pin_t dip_switch_pad_right[] = DIP_SWITCH_PINS_RIGHT; + for (uint8_t i = 0; i < NUMBER_OF_DIP_SWITCHES; i++) { + dip_switch_pad[i] = dip_switch_pad_right[i]; + } + } +# endif for (uint8_t i = 0; i < NUMBER_OF_DIP_SWITCHES; i++) { setPinInputHigh(dip_switch_pad[i]); } |
