From 409ff554d4e4e9915a7c013820896c7876cc790d Mon Sep 17 00:00:00 2001 From: "Lukas F. Hartmann" Date: Tue, 16 Jan 2024 14:15:42 +0100 Subject: [PATCH] kbd: change power key to hyper+return, test wake with f12 --- .../pocket-hid/src/main.c | 13 +++++++++---- .../pocket-hid/src/matrix.h | 19 +++++++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/pocket-reform-keyboard-fw/pocket-hid/src/main.c b/pocket-reform-keyboard-fw/pocket-hid/src/main.c index e41c36f..274c921 100644 --- a/pocket-reform-keyboard-fw/pocket-hid/src/main.c +++ b/pocket-reform-keyboard-fw/pocket-hid/src/main.c @@ -365,6 +365,11 @@ void remote_turn_off_som() { soc_power_on = 0; } +void remote_wake_som() { + uart_puts(UART_ID, "\r\n1w\r\n"); + anim_hello(); +} + int process_keyboard(uint8_t* resulting_scancodes) { // how many keys are pressed this round uint8_t total_pressed = 0; @@ -429,7 +434,7 @@ int process_keyboard(uint8_t* resulting_scancodes) { // Is circle key pressed? // FIXME HACK - if (keycode == KEY_POWER && !command_sent) { + if (keycode == KEY_ENTER && fn_key && !command_sent) { if (!soc_power_on) { remote_turn_on_som(); command_sent = 1; @@ -438,6 +443,8 @@ int process_keyboard(uint8_t* resulting_scancodes) { remote_turn_off_som(); command_sent = 1; } + } else if (keycode == KEY_F12) { + remote_wake_som(); } else if (keycode == KEY_COMPOSE) { fn_key = 1; active_matrix = matrix_fn; @@ -681,10 +688,8 @@ void hid_task(void) if ( board_millis() - start_ms < interval_ms) return; // not enough time start_ms += interval_ms; - uint32_t const btn = 0; //board_button_read(); - // Remote wakeup - if ( tud_suspended() && btn ) + if ( tud_suspended() && pressed_keycodes[0] ) { // Wake up host if we are in suspend mode // and REMOTE_WAKEUP feature is enabled by host diff --git a/pocket-reform-keyboard-fw/pocket-hid/src/matrix.h b/pocket-reform-keyboard-fw/pocket-hid/src/matrix.h index 61e8b95..1d895fa 100644 --- a/pocket-reform-keyboard-fw/pocket-hid/src/matrix.h +++ b/pocket-reform-keyboard-fw/pocket-hid/src/matrix.h @@ -64,7 +64,7 @@ KEY_COMMA,\ KEY_DOT,\ KEY_UP,\ - KEY_RIGHTSHIFT + KEY_RIGHTALT // Sixth row #define MATRIX_DEFAULT_ROW_5 \ @@ -120,7 +120,18 @@ uint8_t matrix_fn[KBD_MATRIX_SZ] = { KEY_RIGHTBRACE, KEY_SEMICOLON, - MATRIX_DEFAULT_ROW_3, + KEY_LEFTCTRL, + KEY_A, + KEY_S, + KEY_D, + KEY_F, + KEY_G, + KEY_H, + KEY_J, + KEY_K, + KEY_L, + KEY_APOSTROPHE, + KEY_ENTER, KEY_LEFTSHIFT, KEY_Z, @@ -140,8 +151,8 @@ uint8_t matrix_fn[KBD_MATRIX_SZ] = { KEY_RIGHTALT, KEY_BACKSLASH, KEY_EQUAL, - KEY_POWER, - KEY_POWER, + KEY_SPACE, + KEY_SPACE, KEY_MINUS, KEY_SLASH, KEY_HOME,