mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-22 03:19:24 +00:00
suspend: update wake up matrix after wake up delay
If USB_SUSPEND_WAKEUP_DELAY is set, the keyboard sleeps during wake up - which can be up to multiple seconds. To not miss any key releases the wake up matrix is updated with the current state of the matrix - only resetting the keys that have been released. Signed-off-by: Stefan Kerkmann <karlk90@pm.me>
This commit is contained in:
parent
fe35558ec7
commit
71521d71c5
@ -56,6 +56,20 @@ bool suspend_wakeup_condition(void) {
|
|||||||
return wakeup;
|
return wakeup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wakeup_matrix_update(void) {
|
||||||
|
matrix_power_up();
|
||||||
|
matrix_scan();
|
||||||
|
matrix_power_down();
|
||||||
|
|
||||||
|
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||||
|
matrix_row_t matrix_row = matrix_get_row(row);
|
||||||
|
matrix_row_t col_mask = 1;
|
||||||
|
for (uint8_t col = 0; col < MATRIX_COLS; col++, col_mask <<= 1) {
|
||||||
|
wakeup_matrix_handle_key_event(row, col, matrix_row & col_mask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool keypress_is_wakeup_key(uint8_t row, uint8_t col) {
|
bool keypress_is_wakeup_key(uint8_t row, uint8_t col) {
|
||||||
return (wakeup_matrix[row] & ((matrix_row_t)1 << col));
|
return (wakeup_matrix[row] & ((matrix_row_t)1 << col));
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ void suspend_power_down_kb(void);
|
|||||||
void suspend_power_down_quantum(void);
|
void suspend_power_down_quantum(void);
|
||||||
|
|
||||||
bool keypress_is_wakeup_key(uint8_t row, uint8_t col);
|
bool keypress_is_wakeup_key(uint8_t row, uint8_t col);
|
||||||
|
void wakeup_matrix_update(void);
|
||||||
void wakeup_matrix_handle_key_event(uint8_t row, uint8_t col, bool pressed);
|
void wakeup_matrix_handle_key_event(uint8_t row, uint8_t col, bool pressed);
|
||||||
|
|
||||||
#ifndef USB_SUSPEND_WAKEUP_DELAY
|
#ifndef USB_SUSPEND_WAKEUP_DELAY
|
||||||
|
@ -194,6 +194,9 @@ void protocol_pre_task(void) {
|
|||||||
//
|
//
|
||||||
// Pause for a while to let things settle...
|
// Pause for a while to let things settle...
|
||||||
wait_ms(USB_SUSPEND_WAKEUP_DELAY);
|
wait_ms(USB_SUSPEND_WAKEUP_DELAY);
|
||||||
|
// ...and then update the wakeup matrix again as the waking key
|
||||||
|
// might have been released during the delay
|
||||||
|
wakeup_matrix_update();
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -848,6 +848,9 @@ void protocol_pre_task(void) {
|
|||||||
//
|
//
|
||||||
// Pause for a while to let things settle...
|
// Pause for a while to let things settle...
|
||||||
wait_ms(USB_SUSPEND_WAKEUP_DELAY);
|
wait_ms(USB_SUSPEND_WAKEUP_DELAY);
|
||||||
|
// ...and then update the wakeup matrix again as the waking key
|
||||||
|
// might have been released during the delay
|
||||||
|
wakeup_matrix_update();
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,6 +145,9 @@ void protocol_pre_task(void) {
|
|||||||
//
|
//
|
||||||
// Pause for a while to let things settle...
|
// Pause for a while to let things settle...
|
||||||
wait_ms(USB_SUSPEND_WAKEUP_DELAY);
|
wait_ms(USB_SUSPEND_WAKEUP_DELAY);
|
||||||
|
// ...and then update the wakeup matrix again as the waking key
|
||||||
|
// might have been released during the delay
|
||||||
|
wakeup_matrix_update();
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user