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
This commit is contained in:
committed by
Florian Didron
parent
af26d4b1fe
commit
ab799d5628
@@ -35,9 +35,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
#include "debounce.h"
|
#include "debounce.h"
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
#ifdef DEBUG_MATRIX_SCAN_RATE
|
|
||||||
# include "timer.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This constant define not debouncing time in msecs, assuming eager_pr.
|
* This constant define not debouncing time in msecs, assuming eager_pr.
|
||||||
@@ -67,11 +64,6 @@ static void select_row(uint8_t row);
|
|||||||
static uint8_t mcp23018_reset_loop;
|
static uint8_t mcp23018_reset_loop;
|
||||||
// static uint16_t mcp23018_reset_loop;
|
// static uint16_t mcp23018_reset_loop;
|
||||||
|
|
||||||
#ifdef DEBUG_MATRIX_SCAN_RATE
|
|
||||||
uint32_t matrix_timer;
|
|
||||||
uint32_t matrix_scan_count;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__attribute__((weak)) void matrix_init_user(void) {}
|
__attribute__((weak)) void matrix_init_user(void) {}
|
||||||
|
|
||||||
__attribute__((weak)) void matrix_scan_user(void) {}
|
__attribute__((weak)) void matrix_scan_user(void) {}
|
||||||
@@ -98,10 +90,6 @@ void matrix_init(void) {
|
|||||||
raw_matrix[i] = 0;
|
raw_matrix[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_MATRIX_SCAN_RATE
|
|
||||||
matrix_timer = timer_read32();
|
|
||||||
matrix_scan_count = 0;
|
|
||||||
#endif
|
|
||||||
debounce_init(MATRIX_ROWS);
|
debounce_init(MATRIX_ROWS);
|
||||||
matrix_init_quantum();
|
matrix_init_quantum();
|
||||||
}
|
}
|
||||||
@@ -116,11 +104,6 @@ void matrix_power_up(void) {
|
|||||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||||
matrix[i] = 0;
|
matrix[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_MATRIX_SCAN_RATE
|
|
||||||
matrix_timer = timer_read32();
|
|
||||||
matrix_scan_count = 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reads and stores a row, returning
|
// Reads and stores a row, returning
|
||||||
@@ -151,20 +134,6 @@ uint8_t matrix_scan(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_MATRIX_SCAN_RATE
|
|
||||||
matrix_scan_count++;
|
|
||||||
|
|
||||||
uint32_t timer_now = timer_read32();
|
|
||||||
if (TIMER_DIFF_32(timer_now, matrix_timer) > 1000) {
|
|
||||||
print("matrix scan frequency: ");
|
|
||||||
pdec(matrix_scan_count);
|
|
||||||
print("\n");
|
|
||||||
|
|
||||||
matrix_timer = timer_now;
|
|
||||||
matrix_scan_count = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef LEFT_LEDS
|
#ifdef LEFT_LEDS
|
||||||
mcp23018_status = ergodox_left_leds_update();
|
mcp23018_status = ergodox_left_leds_update();
|
||||||
#endif // LEFT_LEDS
|
#endif // LEFT_LEDS
|
||||||
|
|||||||
@@ -82,6 +82,26 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
# include "velocikey.h"
|
# include "velocikey.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Only enable this if console is enabled to print to
|
||||||
|
#if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE)
|
||||||
|
static uint32_t matrix_timer = 0;
|
||||||
|
static uint32_t matrix_scan_count = 0;
|
||||||
|
|
||||||
|
void matrix_scan_perf_task(void) {
|
||||||
|
matrix_scan_count++;
|
||||||
|
|
||||||
|
uint32_t timer_now = timer_read32();
|
||||||
|
if (TIMER_DIFF_32(timer_now, matrix_timer) > 1000) {
|
||||||
|
dprintf("matrix scan frequency: %d\n", matrix_scan_count);
|
||||||
|
|
||||||
|
matrix_timer = timer_now;
|
||||||
|
matrix_scan_count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# define matrix_scan_perf_task()
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MATRIX_HAS_GHOST
|
#ifdef MATRIX_HAS_GHOST
|
||||||
extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
|
extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
|
||||||
static matrix_row_t get_real_keys(uint8_t row, matrix_row_t rowdata) {
|
static matrix_row_t get_real_keys(uint8_t row, matrix_row_t rowdata) {
|
||||||
@@ -296,6 +316,10 @@ void keyboard_task(void) {
|
|||||||
|
|
||||||
MATRIX_LOOP_END:
|
MATRIX_LOOP_END:
|
||||||
|
|
||||||
|
#ifdef DEBUG_MATRIX_SCAN_RATE
|
||||||
|
matrix_scan_perf_task();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef QWIIC_ENABLE
|
#ifdef QWIIC_ENABLE
|
||||||
qwiic_task();
|
qwiic_task();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user