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 6 commits
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/q0.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@

#include "quantum.h"

#ifdef ENCODER_ENABLE
adophoxia marked this conversation as resolved.
Show resolved Hide resolved
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
adophoxia marked this conversation as resolved.
Show resolved Hide resolved
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
adophoxia marked this conversation as resolved.
Show resolved Hide resolved
}
}
return true;
}
#endif // ENCODER_ENABLE

#if defined(RGB_MATRIX_ENABLE) && defined(NUM_LOCK_LED_INDEX)

bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
Expand Down
1 change: 1 addition & 0 deletions keyboards/keychron/q0/rev_0130/rev_0130.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,4 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

1 change: 1 addition & 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,4 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

14 changes: 14 additions & 0 deletions keyboards/keychron/q1/q1.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,17 @@ 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 // ENCODER_ENABLE
1 change: 1 addition & 0 deletions keyboards/keychron/q10/ansi_encoder/ansi_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,4 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

1 change: 1 addition & 0 deletions keyboards/keychron/q10/iso_encoder/iso_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,4 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

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 // ENCODER_ENABLE

#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 // ENCODER_ENABLE

#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/q2.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 // ENCODER_ENABLE

#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/q3/q3.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,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 // ENCODER_ENABLE

#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/q5/q5.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 // ENCODER_ENABLE

#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) {
Expand Down
14 changes: 14 additions & 0 deletions keyboards/keychron/q6/q6.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 // ENCODER_ENABLE

#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) {
Expand Down
1 change: 1 addition & 0 deletions keyboards/keychron/q65/ansi_encoder/ansi_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,4 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

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 // ENCODER_ENABLE

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

Expand Down
14 changes: 14 additions & 0 deletions keyboards/keychron/q8/q8.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 // ENCODER_ENABLE

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

bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
Expand Down
1 change: 1 addition & 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,4 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

14 changes: 14 additions & 0 deletions keyboards/keychron/q9/q9.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,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 // ENCODER_ENABLE

#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/v1/v1.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

#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 // ENCODER_ENABLE

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

bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
Expand Down
1 change: 1 addition & 0 deletions keyboards/keychron/v10/ansi_encoder/ansi_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,4 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

1 change: 1 addition & 0 deletions keyboards/keychron/v10/iso_encoder/iso_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,4 @@ led_config_t g_led_config = {
};

#endif // RGB_MATRIX_ENABLE

28 changes: 14 additions & 14 deletions keyboards/keychron/v10/v10.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 Expand Up @@ -84,17 +98,3 @@ bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
}

#endif // CAPS_LOCK_LED_INDEX

#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_delay(KC_VOLU, 10);
} else {
tap_code_delay(KC_VOLD, 10);
}
}
return true;
}
#endif
14 changes: 14 additions & 0 deletions keyboards/keychron/v2/v2.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 // ENCODER_ENABLE

#if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX)
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) { return false; }
Expand Down
14 changes: 14 additions & 0 deletions keyboards/keychron/v3/v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,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 // ENCODER_ENABLE

#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/v5/v5.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 // ENCODER_ENABLE

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

bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
Expand Down
Loading