Merge remote-tracking branch 'qmk/master' into merge-2022-03-06

This commit is contained in:
Ilya Zhuravlev 2022-03-06 20:04:27 -06:00
commit 3a3c93383f
7966 changed files with 179285 additions and 62739 deletions

View file

@ -59,9 +59,17 @@ static uint8_t thisHand, thatHand;
static uint8_t encoder_value[NUMBER_OF_ENCODERS] = {0};
#endif
__attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) { return true; }
__attribute__((weak)) void encoder_wait_pullup_charge(void) {
wait_us(100);
}
__attribute__((weak)) bool encoder_update_kb(uint8_t index, bool clockwise) { return encoder_update_user(index, clockwise); }
__attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) {
return true;
}
__attribute__((weak)) bool encoder_update_kb(uint8_t index, bool clockwise) {
return encoder_update_user(index, clockwise);
}
#ifdef VIAL_ENCODERS_ENABLE
#include "vial.h"
@ -89,7 +97,9 @@ void encoder_init(void) {
for (int i = 0; i < NUMBER_OF_ENCODERS; i++) {
setPinInputHigh(encoders_pad_a[i]);
setPinInputHigh(encoders_pad_b[i]);
}
encoder_wait_pullup_charge();
for (int i = 0; i < NUMBER_OF_ENCODERS; i++) {
encoder_state[i] = (readPin(encoders_pad_a[i]) << 0) | (readPin(encoders_pad_b[i]) << 1);
}
@ -118,7 +128,7 @@ static bool encoder_update(uint8_t index, uint8_t state) {
changed = true;
encoder_update_kb(index, ENCODER_COUNTER_CLOCKWISE);
}
if (encoder_pulses[i] <= -resolution) { // direction is arbitrary here, but this clockwise
if (encoder_pulses[i] <= -resolution) { // direction is arbitrary here, but this clockwise
encoder_value[index]--;
changed = true;
encoder_update_kb(index, ENCODER_CLOCKWISE);
@ -145,7 +155,9 @@ bool encoder_read(void) {
#ifdef SPLIT_KEYBOARD
void last_encoder_activity_trigger(void);
void encoder_state_raw(uint8_t* slave_state) { memcpy(slave_state, &encoder_value[thisHand], sizeof(uint8_t) * NUMBER_OF_ENCODERS); }
void encoder_state_raw(uint8_t* slave_state) {
memcpy(slave_state, &encoder_value[thisHand], sizeof(uint8_t) * NUMBER_OF_ENCODERS);
}
void encoder_update_raw(uint8_t* slave_state) {
bool changed = false;