]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
DO NOT USE Revert back to original API to support split_keyboards.
authoralex-ong <the.onga@gmail.com>
Sat, 26 Jan 2019 06:10:27 +0000 (17:10 +1100)
committeralex-ong <the.onga@gmail.com>
Sat, 26 Jan 2019 06:10:27 +0000 (17:10 +1100)
quantum/debounce.h
quantum/debounce/debounce_sym_g.c
quantum/matrix.c

index 7fe2d693d19827f4e5a7fed68e85c4096e2d6d54..34b952ee72e79afb7b24c3521c3c9bdea70ea969 100644 (file)
@@ -16,11 +16,11 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 #include "matrix.h"
 
-void debounce_init(void); //every debounce algorithm will have unique storage needs.
+void debounce_init(uint8_t num_rows); //every debounce algorithm will have unique storage needs.
 
 // raw is the current key state
 // cooked is the debounced input/output key state
 // changed is true if raw has changed since the last call
-void debounce(matrix_row_t raw[], matrix_row_t cooked[], bool changed);
+void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed);
 
 bool debounce_active(void);
index c206f28647a0572da169fea515058492af22f341..4a6996c73d435309667e50ff72e051d56e8cc389 100644 (file)
@@ -26,10 +26,10 @@ When no state changes have occured for DEBOUNCE milliseconds, we push the state.
 static bool debouncing = false;
 static uint16_t debouncing_time;
 
-void debounce_init(void) {}
+void debounce_init(uint8_t num_rows) {}
 
 #if DEBOUNCE > 0
-void debounce(matrix_row_t raw[], matrix_row_t cooked[], bool changed)
+void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed)
 {
   if (changed) {
     debouncing = true;
@@ -37,14 +37,14 @@ void debounce(matrix_row_t raw[], matrix_row_t cooked[], bool changed)
   }
 
   if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
-    for (int i = 0; i < MATRIX_ROWS; i++) {
+    for (int i = 0; i < num_rows; i++) {
       cooked[i] = raw[i];
     }
     debouncing = false;
   }
 }
 #else //no debouncing.
-void debounce(matrix_row_t raw[], matrix_row_t cooked[], bool changed)
+void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed)
 {
   for (int i = 0; i < MATRIX_ROWS; i++) {
     cooked[i] = raw[i];
index 8fc4175bde38bd518ca6a11de8c28b2ba37552bc..5b7a0e03b11ad042aa89390271f98bdf9b70f33d 100644 (file)
@@ -122,7 +122,7 @@ void matrix_init(void) {
         raw_matrix[i] = 0;
         matrix[i] = 0;
     }
-    debounce_init();
+    debounce_init(MATRIX_ROWS);
 
     matrix_init_quantum();
 }
@@ -143,7 +143,7 @@ uint8_t matrix_scan(void)
   }
 #endif
 
-  debounce(raw_matrix, matrix, changed);
+  debounce(raw_matrix, matrix, MATRIX_ROWS, changed);
 
   matrix_scan_quantum();
   return 1;