diff options
| author | Joel Challis <git@zvecr.com> | 2019-10-15 13:32:52 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-15 13:32:52 +0100 |
| commit | cc5edb9eeb2d30400dee278a6f20991389f68afe (patch) | |
| tree | 4fb8bdd3ec143345a787474f46add0f53ce782f7 /tmk_core | |
| parent | e1de0d74a6f6c4bdc762b32fb78e449aed0fcecb (diff) | |
| download | qmk_firmware-cc5edb9eeb2d30400dee278a6f20991389f68afe.tar.gz qmk_firmware-cc5edb9eeb2d30400dee278a6f20991389f68afe.zip | |
Port DEBUG_MATRIX_SCAN_RATE to core (#7029)
* Port DEBUG_MATRIX_SCAN_RATE to core
* Remove duplicate DEBUG_MATRIX_SCAN_RATE implementations
* Remove duplicate DEBUG_MATRIX_SCAN_RATE implementation from handwired/xealous
* Add console logic from ergodox_ez
Diffstat (limited to 'tmk_core')
| -rw-r--r-- | tmk_core/common/keyboard.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index f4d2cd738..9806b5015 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c | |||
| @@ -82,6 +82,26 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 82 | # include "velocikey.h" | 82 | # include "velocikey.h" |
| 83 | #endif | 83 | #endif |
| 84 | 84 | ||
| 85 | // Only enable this if console is enabled to print to | ||
| 86 | #if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE) | ||
| 87 | static uint32_t matrix_timer = 0; | ||
| 88 | static uint32_t matrix_scan_count = 0; | ||
| 89 | |||
| 90 | void matrix_scan_perf_task(void) { | ||
| 91 | matrix_scan_count++; | ||
| 92 | |||
| 93 | uint32_t timer_now = timer_read32(); | ||
| 94 | if (TIMER_DIFF_32(timer_now, matrix_timer) > 1000) { | ||
| 95 | dprintf("matrix scan frequency: %d\n", matrix_scan_count); | ||
| 96 | |||
| 97 | matrix_timer = timer_now; | ||
| 98 | matrix_scan_count = 0; | ||
| 99 | } | ||
| 100 | } | ||
| 101 | #else | ||
| 102 | # define matrix_scan_perf_task() | ||
| 103 | #endif | ||
| 104 | |||
| 85 | #ifdef MATRIX_HAS_GHOST | 105 | #ifdef MATRIX_HAS_GHOST |
| 86 | extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; | 106 | extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; |
| 87 | static matrix_row_t get_real_keys(uint8_t row, matrix_row_t rowdata) { | 107 | static matrix_row_t get_real_keys(uint8_t row, matrix_row_t rowdata) { |
| @@ -301,6 +321,10 @@ void keyboard_task(void) { | |||
| 301 | 321 | ||
| 302 | MATRIX_LOOP_END: | 322 | MATRIX_LOOP_END: |
| 303 | 323 | ||
| 324 | #ifdef DEBUG_MATRIX_SCAN_RATE | ||
| 325 | matrix_scan_perf_task(); | ||
| 326 | #endif | ||
| 327 | |||
| 304 | #ifdef QWIIC_ENABLE | 328 | #ifdef QWIIC_ENABLE |
| 305 | qwiic_task(); | 329 | qwiic_task(); |
| 306 | #endif | 330 | #endif |
