mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-22 00:16:41 +06:00
Update keychron_common.c
This commit is contained in:
parent
53b3468dbf
commit
4e97b06dde
|
@ -189,34 +189,12 @@ bool led_update_kb(led_t led_state) {
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef ENCODER_ENABLE
|
||||
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||
if (!encoder_update_user(index, clockwise)) {
|
||||
return false; /* Don't process further events if user function exists and returns false */
|
||||
}
|
||||
if (index == 0) { /* First encoder */
|
||||
if (clockwise) {
|
||||
tap_code_delay(KC_VOLU, 10);
|
||||
} else {
|
||||
tap_code_delay(KC_VOLD, 10);
|
||||
}
|
||||
} else if (index == 1) { /* Second encoder */
|
||||
if (clockwise) {
|
||||
tap_code_delay(KC_VOLU, 10);
|
||||
} else {
|
||||
tap_code_delay(KC_VOLD, 10);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
|
||||
static void encoder_pad_cb(void *param) {
|
||||
encoder_inerrupt_read((uint32_t)param & 0XFF);
|
||||
}
|
||||
|
||||
void keyboard_post_init_keychron(void) {
|
||||
void keyboard_post_init_kb(void) {
|
||||
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
|
||||
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
|
||||
for (uint32_t i = 0; i < NUM_ENCODERS; i++) {
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
#include "keychron_ft_common.h"
|
||||
#include "raw_hid.h"
|
||||
|
||||
#ifndef NKRO
|
||||
# include <string.h>
|
||||
# define RAW_EPSIZE 32
|
||||
#endif
|
||||
|
||||
#ifndef BL_TEST_KEY1
|
||||
# define BL_TEST_KEY1 KC_RIGHT
|
||||
#endif
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
|
||||
#include "quantum.h"
|
||||
#include "keychron_common.h"
|
||||
|
||||
#ifdef DIP_SWITCH_ENABLE
|
||||
bool dip_switch_update_kb(uint8_t index, bool active) {
|
||||
|
@ -28,14 +27,3 @@ bool dip_switch_update_kb(uint8_t index, bool active) {
|
|||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
|
||||
|
||||
void keyboard_post_init_kb(void) {
|
||||
keyboard_post_init_keychron();
|
||||
|
||||
// allow user keymaps to do custom post_init
|
||||
keyboard_post_init_user();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user