diff options
-rw-r--r-- | docs/feature_encoders.md | 9 | ||||
-rw-r--r-- | docs/feature_split_keyboard.md | 7 | ||||
-rw-r--r-- | quantum/encoder.c | 14 |
3 files changed, 30 insertions, 0 deletions
diff --git a/docs/feature_encoders.md b/docs/feature_encoders.md index bb2d538e7..cbf72914e 100644 --- a/docs/feature_encoders.md +++ b/docs/feature_encoders.md | |||
@@ -20,6 +20,15 @@ Additionally, the resolution can be specified in the same file (the default & su | |||
20 | 20 | ||
21 | #define ENCODER_RESOLUTION 4 | 21 | #define ENCODER_RESOLUTION 4 |
22 | 22 | ||
23 | ## Split Keyboards | ||
24 | |||
25 | If you are using different pinouts for the encoders on each half of a split keyboard, you can define the pinout for the right half like this: | ||
26 | |||
27 | ```c | ||
28 | #define ENCODERS_PAD_A_RIGHT { encoder1a, encoder2a } | ||
29 | #define ENCODERS_PAD_B_RIGHT { encoder1b, encoder2b } | ||
30 | ``` | ||
31 | |||
23 | ## Callbacks | 32 | ## Callbacks |
24 | 33 | ||
25 | The callback functions can be inserted into your `<keyboard>.c`: | 34 | The callback functions can be inserted into your `<keyboard>.c`: |
diff --git a/docs/feature_split_keyboard.md b/docs/feature_split_keyboard.md index 4addb1bfd..60e0d278c 100644 --- a/docs/feature_split_keyboard.md +++ b/docs/feature_split_keyboard.md | |||
@@ -167,6 +167,13 @@ This allows you to specify a different set of pins for the matrix on the right s | |||
167 | This allows you to specify a different set of direct pins for the right side. | 167 | This allows you to specify a different set of direct pins for the right side. |
168 | 168 | ||
169 | ```c | 169 | ```c |
170 | #define ENCODERS_PAD_A_RIGHT { encoder1a, encoder2a } | ||
171 | #define ENCODERS_PAD_B_RIGHT { encoder1b, encoder2b } | ||
172 | ``` | ||
173 | |||
174 | This allows you to specify a different set of encoder pins for the right side. | ||
175 | |||
176 | ```c | ||
170 | #define RGBLIGHT_SPLIT | 177 | #define RGBLIGHT_SPLIT |
171 | ``` | 178 | ``` |
172 | 179 | ||
diff --git a/quantum/encoder.c b/quantum/encoder.c index 31f00c346..10d8cf7da 100644 --- a/quantum/encoder.c +++ b/quantum/encoder.c | |||
@@ -16,6 +16,9 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "encoder.h" | 18 | #include "encoder.h" |
19 | #ifdef SPLIT_KEYBOARD | ||
20 | #include "split_util.h" | ||
21 | #endif | ||
19 | 22 | ||
20 | // for memcpy | 23 | // for memcpy |
21 | #include <string.h> | 24 | #include <string.h> |
@@ -54,6 +57,17 @@ void encoder_update_kb(int8_t index, bool clockwise) { | |||
54 | } | 57 | } |
55 | 58 | ||
56 | void encoder_init(void) { | 59 | void encoder_init(void) { |
60 | #if defined(SPLIT_KEYBOARD) && defined(ENCODERS_PAD_A_RIGHT) && defined(ENCODERS_PAD_B_RIGHT) | ||
61 | if (!isLeftHand) { | ||
62 | const pin_t encoders_pad_a_right[] = ENCODERS_PAD_A_RIGHT; | ||
63 | const pin_t encoders_pad_b_right[] = ENCODERS_PAD_B_RIGHT; | ||
64 | for (uint8_t i = 0; i < NUMBER_OF_ENCODERS; i++) { | ||
65 | encoders_pad_a[i] = encoders_pad_a_right[i]; | ||
66 | encoders_pad_b[i] = encoders_pad_b_right[i]; | ||
67 | } | ||
68 | } | ||
69 | #endif | ||
70 | |||
57 | for (int i = 0; i < NUMBER_OF_ENCODERS; i++) { | 71 | for (int i = 0; i < NUMBER_OF_ENCODERS; i++) { |
58 | setPinInputHigh(encoders_pad_a[i]); | 72 | setPinInputHigh(encoders_pad_a[i]); |
59 | setPinInputHigh(encoders_pad_b[i]); | 73 | setPinInputHigh(encoders_pad_b[i]); |