diff options
author | Danny <nooges@users.noreply.github.com> | 2019-08-16 19:46:41 -0400 |
---|---|---|
committer | Florian Didron <fdidron@users.noreply.github.com> | 2019-09-05 16:15:42 +0900 |
commit | 0caa4264c88e7c6aeb6e9d04ee154fa8a12923b4 (patch) | |
tree | a6d9bc062a9c325f4bb8c8e8503991fe447cef85 /quantum/encoder.c | |
parent | 9aba563661cf67d73ef447e4e3f580d9b04c2dcd (diff) |
Add support for different encoder pinout for right half of split keyboard (#6521)
* Add support for different encoder pinouts for split keyboard
* Update documentation for new encoder pinout feature
Diffstat (limited to 'quantum/encoder.c')
-rw-r--r-- | quantum/encoder.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/quantum/encoder.c b/quantum/encoder.c index 31f00c346b..10d8cf7da0 100644 --- a/quantum/encoder.c +++ b/quantum/encoder.c @@ -16,6 +16,9 @@ */ #include "encoder.h" +#ifdef SPLIT_KEYBOARD + #include "split_util.h" +#endif // for memcpy #include <string.h> @@ -54,6 +57,17 @@ void encoder_update_kb(int8_t index, bool clockwise) { } void encoder_init(void) { +#if defined(SPLIT_KEYBOARD) && defined(ENCODERS_PAD_A_RIGHT) && defined(ENCODERS_PAD_B_RIGHT) + if (!isLeftHand) { + const pin_t encoders_pad_a_right[] = ENCODERS_PAD_A_RIGHT; + const pin_t encoders_pad_b_right[] = ENCODERS_PAD_B_RIGHT; + for (uint8_t i = 0; i < NUMBER_OF_ENCODERS; i++) { + encoders_pad_a[i] = encoders_pad_a_right[i]; + encoders_pad_b[i] = encoders_pad_b_right[i]; + } + } +#endif + for (int i = 0; i < NUMBER_OF_ENCODERS; i++) { setPinInputHigh(encoders_pad_a[i]); setPinInputHigh(encoders_pad_b[i]); |