]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
DO NOT USE Merge branch 'master' into debounce_refactor
authorAlex Ong <the.onga@gmail.com>
Sat, 26 Jan 2019 01:13:19 +0000 (12:13 +1100)
committerAlex Ong <the.onga@gmail.com>
Sat, 26 Jan 2019 01:13:19 +0000 (12:13 +1100)
Merged, however now there are two debounce.h and debounce.c to mess around with and coalesce.
# Conflicts:
# quantum/matrix.c

1  2 
quantum/matrix.c

index 292171490c2ae0a98b4d15583b18aa6dc3d1fe72,49a184569612af343def48dd39c2362342c14995..71292db5118aecb850ab85585d39f2ee8f11f40f
@@@ -52,9 -51,11 +51,10 @@@ static const pin_t col_pins[MATRIX_COLS
  #endif
  
  /* matrix state(1:on, 0:off) */
- static matrix_row_t matrix[MATRIX_ROWS];
+ static matrix_row_t raw_matrix[MATRIX_ROWS];
  
+ static matrix_row_t matrix[MATRIX_ROWS];
  
 -
  #if (DIODE_DIRECTION == COL2ROW)
      static void init_cols(void);
      static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row);
@@@ -128,26 -155,29 +130,30 @@@ void matrix_init(void) 
  
  uint8_t matrix_scan(void)
  {
+   bool changed = false;
  
  #if (DIODE_DIRECTION == COL2ROW)
-     // Set row, read cols
-     for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
-         read_cols_on_row(matrix, current_row);
-     }
+   // Set row, read cols
+   for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
+     changed |= read_cols_on_row(raw_matrix, current_row);
+   }
  #elif (DIODE_DIRECTION == ROW2COL)
-     // Set col, read rows
-     for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
-         read_rows_on_col(matrix, current_col);
-     }
+   // Set col, read rows
+   for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
+     changed |= read_rows_on_col(raw_matrix, current_col);
+   }
  #endif
  
-     matrix_scan_quantum();
-     return 1;
+   debounce(raw_matrix, matrix, MATRIX_ROWS, changed);
+   matrix_scan_quantum();
+   return 1;
  }
  
 +//Deprecated.
  bool matrix_is_modified(void)
  {
+     if (debounce_active()) return false;
      return true;
  }