diff --git a/keyboards/keychron/common/keychron_common.c b/keyboards/keychron/common/keychron_common.c index 52248c6335f3..ccc4f2978ee3 100644 --- a/keyboards/keychron/common/keychron_common.c +++ b/keyboards/keychron/common/keychron_common.c @@ -111,3 +111,7 @@ __attribute__((weak)) void keyboard_post_init_kb(void) { } } #endif + +void restart_usb_driver(USBDriver *usbp) { + // Do nothing. Restarting the USB driver on these boards breaks it. +} diff --git a/keyboards/keychron/x0/ansi/red/keymaps/keychron/keymap.c b/keyboards/keychron/x0/ansi/red/keymaps/keychron/keymap.c index 9d107ea61935..601bba9b82e8 100755 --- a/keyboards/keychron/x0/ansi/red/keymaps/keychron/keymap.c +++ b/keyboards/keychron/x0/ansi/red/keymaps/keychron/keymap.c @@ -36,8 +36,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LALT, MO(WIN_FN), MO(WIN_FN), KC_SPC), [WIN_FN] = LAYOUT( - _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, _______, - _______, _______, _______, _______, _______, _______, _______, + _______, KC_BRID, KC_BRIU, KC_TASK, KC_PSCR, KC_CRTA, + _______, KC_7, KC_8, KC_9, KC_0, _______, _______, BL_TOGG, BL_STEP, BL_UP, _______, _______, _______, _______, _______, BL_DOWN, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, diff --git a/keyboards/keychron/x0/config.h b/keyboards/keychron/x0/config.h index fc590f753276..e029e9a476d1 100755 --- a/keyboards/keychron/x0/config.h +++ b/keyboards/keychron/x0/config.h @@ -30,5 +30,5 @@ #define EECONFIG_USER_DATA_SIZE 1 /* Factory test keys */ -#define F_RESET_KEY1 KC_6 +#define F_RESET_KEY1 KC_X #define FN_KEY1 MO(1) diff --git a/keyboards/keychron/x1/x1.c b/keyboards/keychron/x1/x1.c index 86a358707972..4853cd52f60d 100755 --- a/keyboards/keychron/x1/x1.c +++ b/keyboards/keychron/x1/x1.c @@ -64,11 +64,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { win_lock_state = !win_lock_state; eeconfig_update_user_datablock(&win_lock_state); - if (win_lock_state) { - SET_LED_WIN_LOCK_ON; - } else { - SET_LED_WIN_LOCK_OFF; - } } return true; default: diff --git a/keyboards/keychron/x2/config.h b/keyboards/keychron/x2/config.h index 5e5e0e31788a..f9ce44ad0497 100755 --- a/keyboards/keychron/x2/config.h +++ b/keyboards/keychron/x2/config.h @@ -28,7 +28,7 @@ /* Winlock indicator */ #define LED_WIN_LOCK_PIN A5 -#define LED_PIN_ON_STATE 1 +#define LED_WIN_LOCK_PIN_ON_STATE 1 /* User used eeprom */ #define EECONFIG_USER_DATA_SIZE 1 diff --git a/keyboards/keychron/x2/x2.c b/keyboards/keychron/x2/x2.c index 80edadabe0f4..4853cd52f60d 100755 --- a/keyboards/keychron/x2/x2.c +++ b/keyboards/keychron/x2/x2.c @@ -18,8 +18,8 @@ static uint8_t win_lock_state = 0; -#define SET_LED_WIN_LOCK_ON writePin(LED_WIN_LOCK_PIN, LED_PIN_ON_STATE) -#define SET_LED_WIN_LOCK_OFF writePin(LED_WIN_LOCK_PIN, !LED_PIN_ON_STATE) +#define SET_LED_WIN_LOCK_ON writePin(LED_WIN_LOCK_PIN, LED_WIN_LOCK_PIN_ON_STATE) +#define SET_LED_WIN_LOCK_OFF writePin(LED_WIN_LOCK_PIN, !LED_WIN_LOCK_PIN_ON_STATE) static void set_led_win_lock_state(void) { if (win_lock_state) { @@ -64,11 +64,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { win_lock_state = !win_lock_state; eeconfig_update_user_datablock(&win_lock_state); - if (win_lock_state) { - writePin(LED_WIN_LOCK_PIN, LED_PIN_ON_STATE); - } else { - writePin(LED_WIN_LOCK_PIN, !LED_PIN_ON_STATE); - } } return true; default: diff --git a/keyboards/keychron/x3/config.h b/keyboards/keychron/x3/config.h index f7d07ffe5d4b..edc7cec7b233 100755 --- a/keyboards/keychron/x3/config.h +++ b/keyboards/keychron/x3/config.h @@ -28,7 +28,7 @@ /* Winlock indicator */ #define LED_WIN_LOCK_PIN A3 -#define LED_PIN_ON_STATE 1 +#define LED_WIN_LOCK_PIN_ON_STATE 1 /* User used eeprom */ #define EECONFIG_USER_DATA_SIZE 1 diff --git a/keyboards/keychron/x3/x3.c b/keyboards/keychron/x3/x3.c index 80edadabe0f4..4853cd52f60d 100755 --- a/keyboards/keychron/x3/x3.c +++ b/keyboards/keychron/x3/x3.c @@ -18,8 +18,8 @@ static uint8_t win_lock_state = 0; -#define SET_LED_WIN_LOCK_ON writePin(LED_WIN_LOCK_PIN, LED_PIN_ON_STATE) -#define SET_LED_WIN_LOCK_OFF writePin(LED_WIN_LOCK_PIN, !LED_PIN_ON_STATE) +#define SET_LED_WIN_LOCK_ON writePin(LED_WIN_LOCK_PIN, LED_WIN_LOCK_PIN_ON_STATE) +#define SET_LED_WIN_LOCK_OFF writePin(LED_WIN_LOCK_PIN, !LED_WIN_LOCK_PIN_ON_STATE) static void set_led_win_lock_state(void) { if (win_lock_state) { @@ -64,11 +64,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { win_lock_state = !win_lock_state; eeconfig_update_user_datablock(&win_lock_state); - if (win_lock_state) { - writePin(LED_WIN_LOCK_PIN, LED_PIN_ON_STATE); - } else { - writePin(LED_WIN_LOCK_PIN, !LED_PIN_ON_STATE); - } } return true; default: diff --git a/keyboards/keychron/x4/ansi_encoder/red/config.h b/keyboards/keychron/x4/ansi_encoder/red/config.h index 2ccb0b521279..1f82ba627704 100755 --- a/keyboards/keychron/x4/ansi_encoder/red/config.h +++ b/keyboards/keychron/x4/ansi_encoder/red/config.h @@ -25,6 +25,8 @@ # define LED_MATRIX_LED_COUNT 81 /* Winlock indicator */ +# define LED_CAPS_LOCK_INDEX 44 +# define DIM_CAPS_LOCK # define LED_WIN_LOCK_INDEX 72 /* Scan phase of led driver set as MSKPHASE_6CHANNEL(defined as 0x03 in CKLED2001.h) */ @@ -46,4 +48,5 @@ /* Encoder Configuration*/ #ifdef ENCODER_ENABLE # define ENCODER_DEFAULT_POS 0x3 +# define ENCODER_MAP_KEY_DELAY 2 #endif diff --git a/keyboards/keychron/x4/x4.c b/keyboards/keychron/x4/x4.c index a4f2c5c8b48b..f757f3b08d6d 100755 --- a/keyboards/keychron/x4/x4.c +++ b/keyboards/keychron/x4/x4.c @@ -85,5 +85,12 @@ bool led_matrix_indicators_kb(void) { led_matrix_set_value(LED_WIN_LOCK_INDEX, 0); } } +#if defined(LED_CAPS_LOCK_INDEX) + if (host_keyboard_led_state().caps_lock) { +# if defined(DIM_CAPS_LOCK) + led_matrix_set_value(LED_CAPS_LOCK_INDEX, 0); +# endif +#endif + } return true; } diff --git a/keyboards/keychron/x6/x6.c b/keyboards/keychron/x6/x6.c index 0c7355cf260f..4853cd52f60d 100755 --- a/keyboards/keychron/x6/x6.c +++ b/keyboards/keychron/x6/x6.c @@ -64,11 +64,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { win_lock_state = !win_lock_state; eeconfig_update_user_datablock(&win_lock_state); - if (win_lock_state) { - writePin(LED_WIN_LOCK_PIN, LED_WIN_LOCK_PIN_ON_STATE); - } else { - writePin(LED_WIN_LOCK_PIN, !LED_WIN_LOCK_PIN_ON_STATE); - } } return true; default: diff --git a/lib/chibios b/lib/chibios index c717c1b99809..11edb1610980 160000 --- a/lib/chibios +++ b/lib/chibios @@ -1 +1 @@ -Subproject commit c717c1b99809b9ea27a63ba955ba426170563fcb +Subproject commit 11edb1610980f213b9f83161e1715a46fb7e4c51 diff --git a/tmk_core/protocol/chibios/chibios.c b/tmk_core/protocol/chibios/chibios.c index 74d8040df5f3..4d97f1cd82e6 100644 --- a/tmk_core/protocol/chibios/chibios.c +++ b/tmk_core/protocol/chibios/chibios.c @@ -179,35 +179,10 @@ void protocol_post_init(void) { host_set_driver(driver); } -#if defined(STM32_USB_USE_OTG1) -void protocol_pre_task(void) { -# if !defined(NO_USB_STARTUP_CHECK) - if (USB_DRIVER.state == USB_SUSPENDED) { - dprintln("suspending keyboard"); - while (USB_DRIVER.state == USB_SUSPENDED) { - /* Do this in the suspended state */ - suspend_power_down(); // on AVR this deep sleeps for 15ms - /* Remote wakeup */ - if ((USB_DRIVER.status & USB_GETSTATUS_REMOTE_WAKEUP_ENABLED) && suspend_wakeup_condition()) { - usbWakeupHost(&USB_DRIVER); - wait_ms(300); - } - } - /* Woken up */ - // variables has been already cleared by the wakeup hook - send_keyboard_report(); -# ifdef MOUSEKEY_ENABLE - mousekey_send(); -# endif /* MOUSEKEY_ENABLE */ - } -# endif - usb_event_queue_task(); -} -#else void protocol_pre_task(void) { usb_event_queue_task(); -# if !defined(NO_USB_STARTUP_CHECK) +#if !defined(NO_USB_STARTUP_CHECK) if (USB_DRIVER.state == USB_SUSPENDED) { dprintln("suspending keyboard"); while (USB_DRIVER.state == USB_SUSPENDED) { @@ -222,13 +197,12 @@ void protocol_pre_task(void) { /* Woken up */ // variables has been already cleared by the wakeup hook send_keyboard_report(); -# ifdef MOUSEKEY_ENABLE +# ifdef MOUSEKEY_ENABLE mousekey_send(); -# endif /* MOUSEKEY_ENABLE */ +# endif /* MOUSEKEY_ENABLE */ } -# endif -} #endif +} void protocol_post_task(void) { #ifdef CONSOLE_ENABLE