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 /keyboards/handwired | |
parent | e1de0d74a6f6c4bdc762b32fb78e449aed0fcecb (diff) | |
download | firmware-cc5edb9eeb2d30400dee278a6f20991389f68afe.tar.gz firmware-cc5edb9eeb2d30400dee278a6f20991389f68afe.tar.bz2 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 'keyboards/handwired')
-rw-r--r-- | keyboards/handwired/dactyl/matrix.c | 24 | ||||
-rw-r--r-- | keyboards/handwired/frenchdev/matrix.c | 35 | ||||
-rw-r--r-- | keyboards/handwired/xealous/matrix.c | 12 | ||||
-rw-r--r-- | keyboards/handwired/xealous/matrix_scanrate.c | 39 | ||||
-rw-r--r-- | keyboards/handwired/xealous/matrix_scanrate.h | 4 | ||||
-rw-r--r-- | keyboards/handwired/xealous/rules.mk | 2 |
6 files changed, 1 insertions, 115 deletions
diff --git a/keyboards/handwired/dactyl/matrix.c b/keyboards/handwired/dactyl/matrix.c index 28cf37522..faa5c19cf 100644 --- a/keyboards/handwired/dactyl/matrix.c +++ b/keyboards/handwired/dactyl/matrix.c @@ -76,11 +76,6 @@ uint8_t expander_status; uint8_t expander_input_pin_mask; bool i2c_initialized = false; -#ifdef DEBUG_MATRIX_SCAN_RATE -uint32_t matrix_timer; -uint32_t matrix_scan_count; -#endif - #define ROW_SHIFTER ((matrix_row_t)1) __attribute__ ((weak)) @@ -129,11 +124,6 @@ void matrix_init(void) matrix_debouncing[i] = 0; } -#ifdef DEBUG_MATRIX_SCAN_RATE - matrix_timer = timer_read32(); - matrix_scan_count = 0; -#endif - matrix_init_quantum(); } @@ -236,20 +226,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 - #if (DIODE_DIRECTION == COL2ROW) for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) { # if (DEBOUNCE > 0) diff --git a/keyboards/handwired/frenchdev/matrix.c b/keyboards/handwired/frenchdev/matrix.c index 26c2b3126..c9c7e94ae 100644 --- a/keyboards/handwired/frenchdev/matrix.c +++ b/keyboards/handwired/frenchdev/matrix.c @@ -35,9 +35,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "util.h" #include "matrix.h" #include "frenchdev.h" -#ifdef DEBUG_MATRIX_SCAN_RATE -#include "timer.h" -#endif /* * This constant define not debouncing time in msecs, but amount of matrix @@ -66,12 +63,6 @@ static void select_row(uint8_t row); static uint8_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) {} @@ -120,13 +111,7 @@ void matrix_init(void) matrix_debouncing[i] = 0; } -#ifdef DEBUG_MATRIX_SCAN_RATE - matrix_timer = timer_read32(); - matrix_scan_count = 0; -#endif - matrix_init_quantum(); - } void matrix_power_up(void) { @@ -140,12 +125,6 @@ void matrix_power_up(void) { matrix[i] = 0; matrix_debouncing[i] = 0; } - -#ifdef DEBUG_MATRIX_SCAN_RATE - matrix_timer = timer_read32(); - matrix_scan_count = 0; -#endif - } uint8_t matrix_scan(void) @@ -165,20 +144,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 - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { select_row(i); wait_us(30); // without this wait read unstable value. diff --git a/keyboards/handwired/xealous/matrix.c b/keyboards/handwired/xealous/matrix.c index e2d219939..6d43db4d9 100644 --- a/keyboards/handwired/xealous/matrix.c +++ b/keyboards/handwired/xealous/matrix.c @@ -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 diff --git a/keyboards/handwired/xealous/matrix_scanrate.c b/keyboards/handwired/xealous/matrix_scanrate.c deleted file mode 100644 index f2c7cbe6e..000000000 --- a/keyboards/handwired/xealous/matrix_scanrate.c +++ /dev/null @@ -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 diff --git a/keyboards/handwired/xealous/matrix_scanrate.h b/keyboards/handwired/xealous/matrix_scanrate.h deleted file mode 100644 index 18d56cd5b..000000000 --- a/keyboards/handwired/xealous/matrix_scanrate.h +++ /dev/null @@ -1,4 +0,0 @@ -__attribute__((weak)) -void matrix_check_scan_rate(void) {} -__attribute__((weak)) -void matrix_time_between_scans(void) {} diff --git a/keyboards/handwired/xealous/rules.mk b/keyboards/handwired/xealous/rules.mk index ef3357982..adbbf1e10 100644 --- a/keyboards/handwired/xealous/rules.mk +++ b/keyboards/handwired/xealous/rules.mk @@ -1,4 +1,4 @@ -SRC += matrix_scanrate.c matrix.c +SRC += matrix.c # MCU name MCU = atmega32u4 |