diff options
Diffstat (limited to 'quantum/split_common/split_util.c')
-rw-r--r-- | quantum/split_common/split_util.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/quantum/split_common/split_util.c b/quantum/split_common/split_util.c index da870f877..09a307b8e 100644 --- a/quantum/split_common/split_util.c +++ b/quantum/split_common/split_util.c | |||
@@ -11,25 +11,25 @@ | |||
11 | # include "eeconfig.h" | 11 | # include "eeconfig.h" |
12 | #endif | 12 | #endif |
13 | 13 | ||
14 | #if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) | ||
15 | #include "rgblight.h" | ||
16 | #endif | ||
17 | |||
14 | volatile bool isLeftHand = true; | 18 | volatile bool isLeftHand = true; |
15 | 19 | ||
16 | __attribute__((weak)) | 20 | __attribute__((weak)) |
17 | bool is_keyboard_left(void) { | 21 | bool is_keyboard_left(void) { |
18 | #ifdef SPLIT_HAND_PIN | 22 | #if defined(SPLIT_HAND_PIN) |
19 | // Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand | 23 | // Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand |
20 | setPinInput(SPLIT_HAND_PIN); | 24 | setPinInput(SPLIT_HAND_PIN); |
21 | return readPin(SPLIT_HAND_PIN); | 25 | return readPin(SPLIT_HAND_PIN); |
22 | #else | 26 | #elif defined(EE_HANDS) |
23 | #ifdef EE_HANDS | 27 | return eeprom_read_byte(EECONFIG_HANDEDNESS); |
24 | return eeprom_read_byte(EECONFIG_HANDEDNESS); | 28 | #elif defined(MASTER_RIGHT) |
25 | #else | 29 | return !is_keyboard_master(); |
26 | #ifdef MASTER_RIGHT | ||
27 | return !is_keyboard_master(); | ||
28 | #else | ||
29 | return is_keyboard_master(); | ||
30 | #endif | ||
31 | #endif | ||
32 | #endif | 30 | #endif |
31 | |||
32 | return is_keyboard_master(); | ||
33 | } | 33 | } |
34 | 34 | ||
35 | bool is_keyboard_master(void) | 35 | bool is_keyboard_master(void) |
@@ -71,6 +71,16 @@ void matrix_setup(void) | |||
71 | { | 71 | { |
72 | isLeftHand = is_keyboard_left(); | 72 | isLeftHand = is_keyboard_left(); |
73 | 73 | ||
74 | #if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) | ||
75 | uint8_t num_rgb_leds_split[2] = RGBLED_SPLIT; | ||
76 | if (isLeftHand) { | ||
77 | rgblight_set_clipping_range(0, num_rgb_leds_split[0]); | ||
78 | } | ||
79 | else { | ||
80 | rgblight_set_clipping_range(num_rgb_leds_split[0], num_rgb_leds_split[1]); | ||
81 | } | ||
82 | #endif | ||
83 | |||
74 | if (is_keyboard_master()) | 84 | if (is_keyboard_master()) |
75 | { | 85 | { |
76 | keyboard_master_setup(); | 86 | keyboard_master_setup(); |