]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - keyboards/sx60/matrix.c
fix unselect_rows() in quantum/matrix.c (#6243)
[qmk_firmware.git] / keyboards / sx60 / matrix.c
index e91b4f441884a61d5d632a81f32117bb86de0338..e8e9d6574e853553a1278a33a30e39be78b58aee 100644 (file)
@@ -30,11 +30,11 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 /* Set 0 if debouncing isn't needed */
 
-#ifndef DEBOUNCING_DELAY
-#   define DEBOUNCING_DELAY 5
+#ifndef DEBOUNCE
+#   define DEBOUNCE 5
 #endif
 
-#if (DEBOUNCING_DELAY > 0)
+#if (DEBOUNCE > 0)
     static uint16_t debouncing_time;
     static bool debouncing = false;
 #endif
@@ -137,7 +137,7 @@ void matrix_init(void) {
 
 uint8_t matrix_scan(void)
 {
-    if (mcp23018_status) { 
+    if (mcp23018_status) {
         /* if there was an error */
         if (++mcp23018_reset_loop == 0) {
             /* since mcp23018_reset_loop is 8 bit - we'll try to reset once in 255 matrix scans
@@ -154,7 +154,7 @@ uint8_t matrix_scan(void)
 
     /* Set row, read cols */
     for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
-#       if (DEBOUNCING_DELAY > 0)
+#       if (DEBOUNCE > 0)
             bool matrix_changed = read_cols_on_row(matrix_debouncing, current_row);
 
             if (matrix_changed) {
@@ -166,8 +166,8 @@ uint8_t matrix_scan(void)
 #       endif
     }
 
-#   if (DEBOUNCING_DELAY > 0)
-        if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) {
+#   if (DEBOUNCE > 0)
+        if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCE)) {
             for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
                 matrix[i] = matrix_debouncing[i];
             }
@@ -181,7 +181,7 @@ uint8_t matrix_scan(void)
 
 bool matrix_is_modified(void)
 {
-#if (DEBOUNCING_DELAY > 0)
+#if (DEBOUNCE > 0)
     if (debouncing) return false;
 #endif
     return true;
@@ -190,7 +190,7 @@ bool matrix_is_modified(void)
 inline
 bool matrix_is_on(uint8_t row, uint8_t col)
 {
-    return (matrix[row] & ((matrix_row_t)1<col));
+    return (matrix[row] & ((matrix_row_t)1<<col));
 }
 
 inline
@@ -246,7 +246,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
     select_row(current_row);
     wait_us(30);
 
-    if (mcp23018_status) { 
+    if (mcp23018_status) {
         /* if there was an error */
         return 0;
     } else {
@@ -279,7 +279,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
 
 static void select_row(uint8_t row)
 {
-    if (mcp23018_status) { 
+    if (mcp23018_status) {
         /* if there was an error do nothing */
     } else {
         /* set active row low  : 0