|
|
|
@ -97,9 +97,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
|
|
|
# include "dip_switch.h" |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
static uint32_t last_input_modification_time = 0; |
|
|
|
|
uint32_t last_input_activity_time(void) { return last_input_modification_time; } |
|
|
|
|
uint32_t last_input_activity_elapsed(void) { return timer_elapsed32(last_input_modification_time); } |
|
|
|
|
|
|
|
|
|
static uint32_t last_matrix_modification_time = 0; |
|
|
|
|
uint32_t last_matrix_activity_time(void) { return last_matrix_modification_time; } |
|
|
|
|
uint32_t last_matrix_activity_elapsed(void) { return timer_elapsed32(last_matrix_modification_time); } |
|
|
|
|
void last_matrix_activity_trigger(void) { last_matrix_modification_time = last_input_modification_time = timer_read32(); } |
|
|
|
|
|
|
|
|
|
static uint32_t last_encoder_modification_time = 0; |
|
|
|
|
uint32_t last_encoder_activity_time(void) { return last_encoder_modification_time; } |
|
|
|
|
uint32_t last_encoder_activity_elapsed(void) { return timer_elapsed32(last_encoder_modification_time); } |
|
|
|
|
void last_encoder_activity_trigger(void) { last_encoder_modification_time = last_input_modification_time = timer_read32(); } |
|
|
|
|
|
|
|
|
|
// Only enable this if console is enabled to print to
|
|
|
|
|
#if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE) |
|
|
|
@ -338,12 +348,15 @@ void keyboard_task(void) { |
|
|
|
|
#ifdef QMK_KEYS_PER_SCAN |
|
|
|
|
uint8_t keys_processed = 0; |
|
|
|
|
#endif |
|
|
|
|
#ifdef ENCODER_ENABLE |
|
|
|
|
bool encoders_changed = false; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
housekeeping_task_kb(); |
|
|
|
|
housekeeping_task_user(); |
|
|
|
|
|
|
|
|
|
uint8_t matrix_changed = matrix_scan(); |
|
|
|
|
if (matrix_changed) last_matrix_modification_time = timer_read32(); |
|
|
|
|
if (matrix_changed) last_matrix_activity_trigger(); |
|
|
|
|
|
|
|
|
|
if (should_process_keypress()) { |
|
|
|
|
for (uint8_t r = 0; r < MATRIX_ROWS; r++) { |
|
|
|
@ -399,7 +412,8 @@ MATRIX_LOOP_END: |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef ENCODER_ENABLE |
|
|
|
|
encoder_read(); |
|
|
|
|
encoders_changed = encoder_read(); |
|
|
|
|
if (encoders_changed) last_encoder_activity_trigger(); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef QWIIC_ENABLE |
|
|
|
@ -409,9 +423,13 @@ MATRIX_LOOP_END: |
|
|
|
|
#ifdef OLED_DRIVER_ENABLE |
|
|
|
|
oled_task(); |
|
|
|
|
# ifndef OLED_DISABLE_TIMEOUT |
|
|
|
|
// Wake up oled if user is using those fabulous keys!
|
|
|
|
|
// Wake up oled if user is using those fabulous keys or spinning those encoders!
|
|
|
|
|
# ifdef ENCODER_ENABLE |
|
|
|
|
if (matrix_changed || encoders_changed) oled_on(); |
|
|
|
|
# else |
|
|
|
|
if (matrix_changed) oled_on(); |
|
|
|
|
# endif |
|
|
|
|
# endif |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef MOUSEKEY_ENABLE |
|
|
|
|