mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-17 21:22:05 +00:00
fix: allow planck/rev7 to be used with ENCODER_ENABLE = no
This commit is contained in:
parent
fdb2851187
commit
d27080f088
@ -67,29 +67,29 @@ void matrix_init_custom(void) {
|
|||||||
wdgStart(&WDGD1, &wdgcfg);
|
wdgStart(&WDGD1, &wdgcfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef ENCODER_ENABLE
|
||||||
bool encoder_update(uint8_t index, uint8_t state) {
|
bool encoder_update(uint8_t index, uint8_t state) {
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
uint8_t i = index;
|
uint8_t i = index;
|
||||||
|
|
||||||
encoder_pulses[i] += encoder_LUT[state & 0xF];
|
// Create function alias
|
||||||
|
#ifdef ENCODER_MAP_ENABLE
|
||||||
|
#define encoder_cntx_fn encoder_exec_mapping
|
||||||
|
#else // ENCODER_MAP_ENABLE
|
||||||
|
#define encoder_cntx_fn encoder_update_kb
|
||||||
|
#endif // ENCODER_MAP_ENABLE
|
||||||
|
|
||||||
|
encoder_pulses[i] += encoder_LUT[state & 0xF];
|
||||||
if (encoder_pulses[i] >= ENCODER_RESOLUTION) {
|
if (encoder_pulses[i] >= ENCODER_RESOLUTION) {
|
||||||
encoder_value[index]++;
|
encoder_value[index]++;
|
||||||
changed = true;
|
changed = true;
|
||||||
#ifdef ENCODER_MAP_ENABLE
|
encoder_cntx_fn(index, false);
|
||||||
encoder_exec_mapping(index, false);
|
|
||||||
#else // ENCODER_MAP_ENABLE
|
|
||||||
encoder_update_kb(index, false);
|
|
||||||
#endif // ENCODER_MAP_ENABLE
|
|
||||||
}
|
}
|
||||||
if (encoder_pulses[i] <= -ENCODER_RESOLUTION) {
|
if (encoder_pulses[i] <= -ENCODER_RESOLUTION) {
|
||||||
encoder_value[index]--;
|
encoder_value[index]--;
|
||||||
changed = true;
|
changed = true;
|
||||||
#ifdef ENCODER_MAP_ENABLE
|
encoder_update_fn(index, true);
|
||||||
encoder_exec_mapping(index, true);
|
|
||||||
#else // ENCODER_MAP_ENABLE
|
|
||||||
encoder_update_kb(index, true);
|
|
||||||
#endif // ENCODER_MAP_ENABLE
|
|
||||||
}
|
}
|
||||||
encoder_pulses[i] %= ENCODER_RESOLUTION;
|
encoder_pulses[i] %= ENCODER_RESOLUTION;
|
||||||
#ifdef ENCODER_DEFAULT_POS
|
#ifdef ENCODER_DEFAULT_POS
|
||||||
@ -97,6 +97,7 @@ bool encoder_update(uint8_t index, uint8_t state) {
|
|||||||
#endif
|
#endif
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
#endif // ENCODER_ENABLE
|
||||||
|
|
||||||
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
|
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
|
||||||
// reset watchdog
|
// reset watchdog
|
||||||
@ -136,8 +137,8 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) {
|
|||||||
changed |= old != current_matrix[row];
|
changed |= old != current_matrix[row];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENCODER_ENABLE // ENCODER_ENABLE
|
||||||
// encoder-matrix functionality
|
// encoder-matrix functionality
|
||||||
|
|
||||||
// set up C/rows for encoder read
|
// set up C/rows for encoder read
|
||||||
for (int i = 0; i < MATRIX_ROWS; i++) {
|
for (int i = 0; i < MATRIX_ROWS; i++) {
|
||||||
setPinOutput(matrix_row_pins[i]);
|
setPinOutput(matrix_row_pins[i]);
|
||||||
@ -168,6 +169,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) {
|
|||||||
for (int i = 0; i < MATRIX_ROWS; i++) {
|
for (int i = 0; i < MATRIX_ROWS; i++) {
|
||||||
setPinInputLow(matrix_row_pins[i]);
|
setPinInputLow(matrix_row_pins[i]);
|
||||||
}
|
}
|
||||||
|
#endif // ENCODER_ENABLE
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user