diff options
| author | fauxpark <fauxpark@gmail.com> | 2022-02-22 03:04:41 +1100 |
|---|---|---|
| committer | fauxpark <fauxpark@gmail.com> | 2022-02-22 03:04:41 +1100 |
| commit | a44abeb99ae79e2fc88f3d323477e7408c5baf41 (patch) | |
| tree | 4449556eac0762b1a3763a923334df70e53fa228 /quantum/encoder.c | |
| parent | 69a67720745ee54fa285383ec94aee7d9fdb3269 (diff) | |
| parent | f30f963a0b6ccaa151fe83dd8302fa1f6829086e (diff) | |
Merge remote-tracking branch 'upstream/master' into develop
Diffstat (limited to 'quantum/encoder.c')
| -rw-r--r-- | quantum/encoder.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/quantum/encoder.c b/quantum/encoder.c index 59133f872a..438c7d8564 100644 --- a/quantum/encoder.c +++ b/quantum/encoder.c | |||
| @@ -59,6 +59,10 @@ static uint8_t thisHand, thatHand; | |||
| 59 | static uint8_t encoder_value[NUMBER_OF_ENCODERS] = {0}; | 59 | static uint8_t encoder_value[NUMBER_OF_ENCODERS] = {0}; |
| 60 | #endif | 60 | #endif |
| 61 | 61 | ||
| 62 | __attribute__((weak)) void encoder_wait_pullup_charge(void) { | ||
| 63 | wait_us(100); | ||
| 64 | } | ||
| 65 | |||
| 62 | __attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) { | 66 | __attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) { |
| 63 | return true; | 67 | return true; |
| 64 | } | 68 | } |
| @@ -88,7 +92,9 @@ void encoder_init(void) { | |||
| 88 | for (int i = 0; i < NUMBER_OF_ENCODERS; i++) { | 92 | for (int i = 0; i < NUMBER_OF_ENCODERS; i++) { |
| 89 | setPinInputHigh(encoders_pad_a[i]); | 93 | setPinInputHigh(encoders_pad_a[i]); |
| 90 | setPinInputHigh(encoders_pad_b[i]); | 94 | setPinInputHigh(encoders_pad_b[i]); |
| 91 | 95 | } | |
| 96 | encoder_wait_pullup_charge(); | ||
| 97 | for (int i = 0; i < NUMBER_OF_ENCODERS; i++) { | ||
| 92 | encoder_state[i] = (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1); | 98 | encoder_state[i] = (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1); |
| 93 | } | 99 | } |
| 94 | 100 | ||
