diff options
| author | QMK Bot <hello@qmk.fm> | 2022-02-12 10:29:31 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-12 18:29:31 +0000 |
| commit | 63646e8906e062d1c1de3925cba70c4e3426a855 (patch) | |
| tree | 4e91648b77b838e1125cf86331d7e84bde6d07a9 /quantum/encoder.c | |
| parent | afcdd7079c774dec2aa4b7f2d08adf8b7310919b (diff) | |
Format code according to conventions (#16322)
Diffstat (limited to 'quantum/encoder.c')
| -rw-r--r-- | quantum/encoder.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/quantum/encoder.c b/quantum/encoder.c index 8fb87281c2..59133f872a 100644 --- a/quantum/encoder.c +++ b/quantum/encoder.c | |||
| @@ -59,9 +59,13 @@ 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)) bool encoder_update_user(uint8_t index, bool clockwise) { return true; } | 62 | __attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) { |
| 63 | return true; | ||
| 64 | } | ||
| 63 | 65 | ||
| 64 | __attribute__((weak)) bool encoder_update_kb(uint8_t index, bool clockwise) { return encoder_update_user(index, clockwise); } | 66 | __attribute__((weak)) bool encoder_update_kb(uint8_t index, bool clockwise) { |
| 67 | return encoder_update_user(index, clockwise); | ||
| 68 | } | ||
| 65 | 69 | ||
| 66 | void encoder_init(void) { | 70 | void encoder_init(void) { |
| 67 | #if defined(SPLIT_KEYBOARD) && defined(ENCODERS_PAD_A_RIGHT) && defined(ENCODERS_PAD_B_RIGHT) | 71 | #if defined(SPLIT_KEYBOARD) && defined(ENCODERS_PAD_A_RIGHT) && defined(ENCODERS_PAD_B_RIGHT) |
| @@ -113,7 +117,7 @@ static bool encoder_update(uint8_t index, uint8_t state) { | |||
| 113 | changed = true; | 117 | changed = true; |
| 114 | encoder_update_kb(index, ENCODER_COUNTER_CLOCKWISE); | 118 | encoder_update_kb(index, ENCODER_COUNTER_CLOCKWISE); |
| 115 | } | 119 | } |
| 116 | if (encoder_pulses[i] <= -resolution) { // direction is arbitrary here, but this clockwise | 120 | if (encoder_pulses[i] <= -resolution) { // direction is arbitrary here, but this clockwise |
| 117 | encoder_value[index]--; | 121 | encoder_value[index]--; |
| 118 | changed = true; | 122 | changed = true; |
| 119 | encoder_update_kb(index, ENCODER_CLOCKWISE); | 123 | encoder_update_kb(index, ENCODER_CLOCKWISE); |
| @@ -140,7 +144,9 @@ bool encoder_read(void) { | |||
| 140 | #ifdef SPLIT_KEYBOARD | 144 | #ifdef SPLIT_KEYBOARD |
| 141 | void last_encoder_activity_trigger(void); | 145 | void last_encoder_activity_trigger(void); |
| 142 | 146 | ||
| 143 | void encoder_state_raw(uint8_t* slave_state) { memcpy(slave_state, &encoder_value[thisHand], sizeof(uint8_t) * NUMBER_OF_ENCODERS); } | 147 | void encoder_state_raw(uint8_t* slave_state) { |
| 148 | memcpy(slave_state, &encoder_value[thisHand], sizeof(uint8_t) * NUMBER_OF_ENCODERS); | ||
| 149 | } | ||
| 144 | 150 | ||
| 145 | void encoder_update_raw(uint8_t* slave_state) { | 151 | void encoder_update_raw(uint8_t* slave_state) { |
| 146 | bool changed = false; | 152 | bool changed = false; |
