diff options
Diffstat (limited to 'tmk_core/common/keyboard.c')
| -rw-r--r-- | tmk_core/common/keyboard.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index 0ca454612..1250c45ae 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c | |||
| @@ -112,21 +112,28 @@ uint32_t last_encoder_activity_elapsed(void) { return timer_elapsed32(las | |||
| 112 | void last_encoder_activity_trigger(void) { last_encoder_modification_time = last_input_modification_time = timer_read32(); } | 112 | void last_encoder_activity_trigger(void) { last_encoder_modification_time = last_input_modification_time = timer_read32(); } |
| 113 | 113 | ||
| 114 | // Only enable this if console is enabled to print to | 114 | // Only enable this if console is enabled to print to |
| 115 | #if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE) | 115 | #if defined(DEBUG_MATRIX_SCAN_RATE) |
| 116 | static uint32_t matrix_timer = 0; | 116 | static uint32_t matrix_timer = 0; |
| 117 | static uint32_t matrix_scan_count = 0; | 117 | static uint32_t matrix_scan_count = 0; |
| 118 | static uint32_t last_matrix_scan_count = 0; | ||
| 118 | 119 | ||
| 119 | void matrix_scan_perf_task(void) { | 120 | void matrix_scan_perf_task(void) { |
| 120 | matrix_scan_count++; | 121 | matrix_scan_count++; |
| 121 | 122 | ||
| 122 | uint32_t timer_now = timer_read32(); | 123 | uint32_t timer_now = timer_read32(); |
| 123 | if (TIMER_DIFF_32(timer_now, matrix_timer) > 1000) { | 124 | if (TIMER_DIFF_32(timer_now, matrix_timer) > 1000) { |
| 125 | # if defined(CONSOLE_ENABLE) | ||
| 124 | dprintf("matrix scan frequency: %d\n", matrix_scan_count); | 126 | dprintf("matrix scan frequency: %d\n", matrix_scan_count); |
| 125 | 127 | # endif | |
| 128 | last_matrix_scan_count = matrix_scan_count; | ||
| 126 | matrix_timer = timer_now; | 129 | matrix_timer = timer_now; |
| 127 | matrix_scan_count = 0; | 130 | matrix_scan_count = 0; |
| 128 | } | 131 | } |
| 129 | } | 132 | } |
| 133 | |||
| 134 | uint32_t get_matrix_scan_rate(void) { | ||
| 135 | return last_matrix_scan_count; | ||
| 136 | } | ||
| 130 | #else | 137 | #else |
| 131 | # define matrix_scan_perf_task() | 138 | # define matrix_scan_perf_task() |
| 132 | #endif | 139 | #endif |
