forked from mirrors/qmk_userspace
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:
parent
e1de0d74a6
commit
cc5edb9eeb
14 changed files with 25 additions and 324 deletions
|
|
@ -30,18 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "pro_micro.h"
|
||||
#include "config.h"
|
||||
#include "timer.h"
|
||||
#ifdef DEBUG_MATRIX_SCAN_RATE
|
||||
#include "matrix_scanrate.h"
|
||||
#endif
|
||||
|
||||
void matrix_scan_user(void)
|
||||
{
|
||||
#ifdef DEBUG_MATRIX_SCAN_RATE
|
||||
matrix_check_scan_rate();
|
||||
matrix_time_between_scans();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// Copy this code to split_common/matrix.c,
|
||||
// and call it instead of the unoptimized col_reader. Scan-rate jumps from 1200->1920
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <avr/io.h>
|
||||
#include "wait.h"
|
||||
#include "print.h"
|
||||
#include "debug.h"
|
||||
#include "util.h"
|
||||
#include "matrix.h"
|
||||
#include "timer.h"
|
||||
|
||||
#ifdef CONSOLE_ENABLE
|
||||
static uint16_t matrix_scan_count = 0;
|
||||
static uint32_t matrix_timer = 0;
|
||||
void matrix_check_scan_rate(void) {
|
||||
matrix_scan_count++;
|
||||
if (matrix_scan_count > 1000) {
|
||||
uint32_t timer_now = timer_read32();
|
||||
uint16_t ms_per_thousand = TIMER_DIFF_32(timer_now, matrix_timer);
|
||||
uint16_t rate_per_second = 1000000UL / ms_per_thousand;
|
||||
print("scan_rate: ");
|
||||
pdec(rate_per_second);
|
||||
print("\n");
|
||||
matrix_timer = timer_now;
|
||||
matrix_scan_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t last_scan_time = 0;
|
||||
void matrix_time_between_scans(void) {
|
||||
if (timer_elapsed(last_scan_time) > 1)
|
||||
{
|
||||
print(">1ms elapsed since last scan: ");
|
||||
pdec(timer_elapsed(last_scan_time));
|
||||
print("\n");
|
||||
}
|
||||
last_scan_time = timer_read();
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
__attribute__((weak))
|
||||
void matrix_check_scan_rate(void) {}
|
||||
__attribute__((weak))
|
||||
void matrix_time_between_scans(void) {}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
SRC += matrix_scanrate.c matrix.c
|
||||
SRC += matrix.c
|
||||
|
||||
# MCU name
|
||||
MCU = atmega32u4
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue