aboutsummaryrefslogtreecommitdiff
path: root/keyboards/massdrop/ctrl/matrix.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/massdrop/ctrl/matrix.c')
-rw-r--r--keyboards/massdrop/ctrl/matrix.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/keyboards/massdrop/ctrl/matrix.c b/keyboards/massdrop/ctrl/matrix.c
index 3580577dc..5f1741e58 100644
--- a/keyboards/massdrop/ctrl/matrix.c
+++ b/keyboards/massdrop/ctrl/matrix.c
@@ -79,8 +79,6 @@ void matrix_init(void)
79 matrix_init_quantum(); 79 matrix_init_quantum();
80} 80}
81 81
82#define MATRIX_SCAN_DELAY 10 //Delay after setting a col to output (in us)
83
84uint64_t mdebouncing = 0; 82uint64_t mdebouncing = 0;
85uint8_t matrix_scan(void) 83uint8_t matrix_scan(void)
86{ 84{
@@ -89,9 +87,7 @@ uint8_t matrix_scan(void)
89 uint8_t col; 87 uint8_t col;
90 uint32_t scans[2]; //PA PB 88 uint32_t scans[2]; //PA PB
91 89
92 if (CLK_get_ms() < mdebouncing) return 1; //mdebouncing == 0 when no debouncing active 90 if (timer_read64() < mdebouncing) return 1; //mdebouncing == 0 when no debouncing active
93
94 //DBG_1_OFF; //Profiling scans
95 91
96 memset(mlatest, 0, MATRIX_ROWS * sizeof(matrix_row_t)); //Zero the result buffer 92 memset(mlatest, 0, MATRIX_ROWS * sizeof(matrix_row_t)); //Zero the result buffer
97 93
@@ -99,7 +95,7 @@ uint8_t matrix_scan(void)
99 { 95 {
100 PORT->Group[col_ports[col]].OUTSET.reg = 1 << col_pins[col]; //Set col output 96 PORT->Group[col_ports[col]].OUTSET.reg = 1 << col_pins[col]; //Set col output
101 97
102 CLK_delay_us(MATRIX_SCAN_DELAY); //Delay for output 98 wait_us(1); //Delay for output
103 99
104 scans[PA] = PORT->Group[PA].IN.reg & row_masks[PA]; //Read PA row pins data 100 scans[PA] = PORT->Group[PA].IN.reg & row_masks[PA]; //Read PA row pins data
105 scans[PB] = PORT->Group[PB].IN.reg & row_masks[PB]; //Read PB row pins data 101 scans[PB] = PORT->Group[PB].IN.reg & row_masks[PB]; //Read PB row pins data
@@ -132,11 +128,9 @@ uint8_t matrix_scan(void)
132 else 128 else
133 { 129 {
134 //Begin or extend debounce on change 130 //Begin or extend debounce on change
135 mdebouncing = CLK_get_ms() + DEBOUNCING_DELAY; 131 mdebouncing = timer_read64() + DEBOUNCING_DELAY;
136 } 132 }
137 133
138 //DBG_1_ON; //Profiling scans
139
140 matrix_scan_quantum(); 134 matrix_scan_quantum();
141 135
142 return 1; 136 return 1;