Merge pull request #192 from lalalademaxiya1/playground

Playground
This commit is contained in:
lalalademaxiya1 2023-10-23 12:28:26 +08:00 committed by GitHub
commit 1eed90de8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 28 additions and 60 deletions

View File

@ -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.
}

View File

@ -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,

View File

@ -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)

View File

@ -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:

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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;
}

View File

@ -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:

@ -1 +1 @@
Subproject commit c717c1b99809b9ea27a63ba955ba426170563fcb
Subproject commit 11edb1610980f213b9f83161e1715a46fb7e4c51

View File

@ -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