kbd: change power key to hyper+return, test wake with f12

This commit is contained in:
Lukas F. Hartmann 2024-01-16 14:15:42 +01:00
parent 38a8ec7417
commit 409ff554d4
2 changed files with 24 additions and 8 deletions

View file

@ -365,6 +365,11 @@ void remote_turn_off_som() {
soc_power_on = 0; 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) { int process_keyboard(uint8_t* resulting_scancodes) {
// how many keys are pressed this round // how many keys are pressed this round
uint8_t total_pressed = 0; uint8_t total_pressed = 0;
@ -429,7 +434,7 @@ int process_keyboard(uint8_t* resulting_scancodes) {
// Is circle key pressed? // Is circle key pressed?
// FIXME HACK // FIXME HACK
if (keycode == KEY_POWER && !command_sent) { if (keycode == KEY_ENTER && fn_key && !command_sent) {
if (!soc_power_on) { if (!soc_power_on) {
remote_turn_on_som(); remote_turn_on_som();
command_sent = 1; command_sent = 1;
@ -438,6 +443,8 @@ int process_keyboard(uint8_t* resulting_scancodes) {
remote_turn_off_som(); remote_turn_off_som();
command_sent = 1; command_sent = 1;
} }
} else if (keycode == KEY_F12) {
remote_wake_som();
} else if (keycode == KEY_COMPOSE) { } else if (keycode == KEY_COMPOSE) {
fn_key = 1; fn_key = 1;
active_matrix = matrix_fn; active_matrix = matrix_fn;
@ -681,10 +688,8 @@ void hid_task(void)
if ( board_millis() - start_ms < interval_ms) return; // not enough time if ( board_millis() - start_ms < interval_ms) return; // not enough time
start_ms += interval_ms; start_ms += interval_ms;
uint32_t const btn = 0; //board_button_read();
// Remote wakeup // Remote wakeup
if ( tud_suspended() && btn ) if ( tud_suspended() && pressed_keycodes[0] )
{ {
// Wake up host if we are in suspend mode // Wake up host if we are in suspend mode
// and REMOTE_WAKEUP feature is enabled by host // and REMOTE_WAKEUP feature is enabled by host

View file

@ -64,7 +64,7 @@
KEY_COMMA,\ KEY_COMMA,\
KEY_DOT,\ KEY_DOT,\
KEY_UP,\ KEY_UP,\
KEY_RIGHTSHIFT KEY_RIGHTALT
// Sixth row // Sixth row
#define MATRIX_DEFAULT_ROW_5 \ #define MATRIX_DEFAULT_ROW_5 \
@ -120,7 +120,18 @@ uint8_t matrix_fn[KBD_MATRIX_SZ] = {
KEY_RIGHTBRACE, KEY_RIGHTBRACE,
KEY_SEMICOLON, 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_LEFTSHIFT,
KEY_Z, KEY_Z,
@ -140,8 +151,8 @@ uint8_t matrix_fn[KBD_MATRIX_SZ] = {
KEY_RIGHTALT, KEY_RIGHTALT,
KEY_BACKSLASH, KEY_BACKSLASH,
KEY_EQUAL, KEY_EQUAL,
KEY_POWER, KEY_SPACE,
KEY_POWER, KEY_SPACE,
KEY_MINUS, KEY_MINUS,
KEY_SLASH, KEY_SLASH,
KEY_HOME, KEY_HOME,