diff options
-rw-r--r-- | docs/feature_encoders.md | 6 | ||||
-rw-r--r-- | quantum/encoder.c | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/docs/feature_encoders.md b/docs/feature_encoders.md index a56f093a3..509f55b91 100644 --- a/docs/feature_encoders.md +++ b/docs/feature_encoders.md | |||
@@ -38,6 +38,12 @@ It can also be defined per-encoder, by instead defining: | |||
38 | #define ENCODER_RESOLUTIONS { 4, 2 } | 38 | #define ENCODER_RESOLUTIONS { 4, 2 } |
39 | ``` | 39 | ``` |
40 | 40 | ||
41 | For 4× encoders you also can assign default position if encoder skips pulses when it changes direction. For example, if your encoder send high level on both pins by default, define this: | ||
42 | |||
43 | ```c | ||
44 | #define ENCODER_DEFAULT_POS 0x3 | ||
45 | ``` | ||
46 | |||
41 | ## Split Keyboards | 47 | ## Split Keyboards |
42 | 48 | ||
43 | If you are using different pinouts for the encoders on each half of a split keyboard, you can define the pinout (and optionally, resolutions) for the right half like this: | 49 | If you are using different pinouts for the encoders on each half of a split keyboard, you can define the pinout (and optionally, resolutions) for the right half like this: |
diff --git a/quantum/encoder.c b/quantum/encoder.c index c30bf01cb..8fb87281c 100644 --- a/quantum/encoder.c +++ b/quantum/encoder.c | |||
@@ -119,6 +119,11 @@ static bool encoder_update(uint8_t index, uint8_t state) { | |||
119 | encoder_update_kb(index, ENCODER_CLOCKWISE); | 119 | encoder_update_kb(index, ENCODER_CLOCKWISE); |
120 | } | 120 | } |
121 | encoder_pulses[i] %= resolution; | 121 | encoder_pulses[i] %= resolution; |
122 | #ifdef ENCODER_DEFAULT_POS | ||
123 | if ((state & 0x3) == ENCODER_DEFAULT_POS) { | ||
124 | encoder_pulses[i] = 0; | ||
125 | } | ||
126 | #endif | ||
122 | return changed; | 127 | return changed; |
123 | } | 128 | } |
124 | 129 | ||