aboutsummaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2021-01-28 10:52:59 +1100
committerNick Brassel <nick@tzarc.org>2021-01-28 10:52:59 +1100
commitd65db68f9f2614b91e3cb565086166b01400e473 (patch)
tree7477dbd7666a170444ffbf2ad29aa6d25189bf50 /tmk_core
parent99f3df28939d89b7fc2d2e7c0ee21b0879c7813f (diff)
parentbad9592a18494e3f678c2a117a526ca5f2f2280d (diff)
downloadqmk_firmware-d65db68f9f2614b91e3cb565086166b01400e473.tar.gz
qmk_firmware-d65db68f9f2614b91e3cb565086166b01400e473.zip
Merge remote-tracking branch 'upstream/master' into develop
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/common/keyboard.c11
-rw-r--r--tmk_core/common/keyboard.h2
2 files changed, 11 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
112void last_encoder_activity_trigger(void) { last_encoder_modification_time = last_input_modification_time = timer_read32(); } 112void 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)
116static uint32_t matrix_timer = 0; 116static uint32_t matrix_timer = 0;
117static uint32_t matrix_scan_count = 0; 117static uint32_t matrix_scan_count = 0;
118static uint32_t last_matrix_scan_count = 0;
118 119
119void matrix_scan_perf_task(void) { 120void 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
134uint32_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
diff --git a/tmk_core/common/keyboard.h b/tmk_core/common/keyboard.h
index 88b3896e9..eaf74bac5 100644
--- a/tmk_core/common/keyboard.h
+++ b/tmk_core/common/keyboard.h
@@ -82,6 +82,8 @@ uint32_t last_matrix_activity_elapsed(void); // Number of milliseconds since th
82uint32_t last_encoder_activity_time(void); // Timestamp of the last encoder activity 82uint32_t last_encoder_activity_time(void); // Timestamp of the last encoder activity
83uint32_t last_encoder_activity_elapsed(void); // Number of milliseconds since the last encoder activity 83uint32_t last_encoder_activity_elapsed(void); // Number of milliseconds since the last encoder activity
84 84
85uint32_t get_matrix_scan_rate(void);
86
85#ifdef __cplusplus 87#ifdef __cplusplus
86} 88}
87#endif 89#endif