Added debug counter of matrix scan frequency
This commit is contained in:
parent
e6ad104bd8
commit
6b7921f91b
2 changed files with 27 additions and 0 deletions
|
|
@ -71,5 +71,6 @@ Project located at <https://github.com/benblazak/ergodox-firmware>
|
|||
//#define NO_ACTION_ONESHOT
|
||||
//#define NO_ACTION_MACRO
|
||||
//#define NO_ACTION_FUNCTION
|
||||
//#define DEBUG_MATRIX_FREQ
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "matrix.h"
|
||||
#include "ergodox.h"
|
||||
#include "i2cmaster.h"
|
||||
#ifdef DEBUG_MATRIX_FREQ
|
||||
#include "timer.h"
|
||||
#endif
|
||||
|
||||
#ifndef DEBOUNCE
|
||||
# define DEBOUNCE 5
|
||||
|
|
@ -44,6 +47,10 @@ static void init_cols(void);
|
|||
static void unselect_rows(uint8_t mcp23018_status);
|
||||
static void select_row(uint8_t mcp23018_status, uint8_t row);
|
||||
|
||||
#ifdef DEBUG_MATRIX_FREQ
|
||||
uint32_t matrix_timer;
|
||||
uint32_t matrix_scan_count;
|
||||
#endif
|
||||
|
||||
inline
|
||||
uint8_t matrix_rows(void)
|
||||
|
|
@ -71,10 +78,29 @@ void matrix_init(void)
|
|||
matrix[i] = 0;
|
||||
matrix_debouncing[i] = 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_MATRIX_FREQ
|
||||
matrix_timer = timer_read32();
|
||||
matrix_scan_count = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t matrix_scan(void)
|
||||
{
|
||||
#ifdef DEBUG_MATRIX_FREQ
|
||||
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 KEYMAP_CUB
|
||||
uint8_t layer = biton32(layer_state);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue