Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add back default Encoder Callbacks for Keychron Q/V series #20307

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions keyboards/keychron/q0/rev_0131/rev_0131.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,17 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
14 changes: 14 additions & 0 deletions keyboards/keychron/q1/ansi_encoder/ansi_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,17 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
14 changes: 14 additions & 0 deletions keyboards/keychron/q1/iso_encoder/iso_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,17 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
14 changes: 14 additions & 0 deletions keyboards/keychron/q10/q10.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@ bool dip_switch_update_kb(uint8_t index, bool active) {

#endif // DIP_SWITCH_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif

#if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX)

bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
Expand Down
14 changes: 14 additions & 0 deletions keyboards/keychron/q12/q12.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
}
#endif

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif

#if defined(RGB_MATRIX_ENABLE) && (defined(CAPS_LOCK_LED_INDEX) || defined(NUM_LOCK_LED_INDEX))
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
Expand Down
14 changes: 14 additions & 0 deletions keyboards/keychron/q2/ansi_encoder/ansi_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,17 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
14 changes: 14 additions & 0 deletions keyboards/keychron/q2/iso_encoder/iso_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,17 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
14 changes: 14 additions & 0 deletions keyboards/keychron/q2/jis_encoder/jis_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,17 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
14 changes: 14 additions & 0 deletions keyboards/keychron/q3/ansi_encoder/ansi_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,17 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
14 changes: 14 additions & 0 deletions keyboards/keychron/q3/iso_encoder/iso_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,17 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
14 changes: 14 additions & 0 deletions keyboards/keychron/q3/jis_encoder/jis_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,17 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
14 changes: 14 additions & 0 deletions keyboards/keychron/q5/ansi_encoder/ansi_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,17 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
14 changes: 14 additions & 0 deletions keyboards/keychron/q5/iso_encoder/iso_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,17 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
14 changes: 14 additions & 0 deletions keyboards/keychron/q6/ansi_encoder/ansi_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,17 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
14 changes: 14 additions & 0 deletions keyboards/keychron/q6/iso_encoder/iso_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,17 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
14 changes: 14 additions & 0 deletions keyboards/keychron/q65/q65.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ bool dip_switch_update_kb(uint8_t index, bool active) {

#endif // DIP_SWITCH_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif

// clang-format on
#if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX)

Expand Down
14 changes: 14 additions & 0 deletions keyboards/keychron/q8/ansi_encoder/ansi_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,17 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
14 changes: 14 additions & 0 deletions keyboards/keychron/q8/iso_encoder/iso_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,17 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
14 changes: 14 additions & 0 deletions keyboards/keychron/q9/ansi_encoder/ansi_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,17 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
14 changes: 14 additions & 0 deletions keyboards/keychron/q9/iso_encoder/iso_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,17 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
Loading