mirror of
				https://github.com/mfulz/qmk_firmware.git
				synced 2025-11-04 07:12:33 +01:00 
			
		
		
		
	DO NOT USE Revert back to original API to support split_keyboards.
This commit is contained in:
		
							parent
							
								
									d0b691df0e
								
							
						
					
					
						commit
						123608fb31
					
				@ -16,11 +16,11 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "matrix.h"
 | 
					#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
 | 
					// raw is the current key state
 | 
				
			||||||
// cooked is the debounced input/output key state
 | 
					// cooked is the debounced input/output key state
 | 
				
			||||||
// changed is true if raw has changed since the last call
 | 
					// 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);
 | 
					bool debounce_active(void);
 | 
				
			||||||
 | 
				
			|||||||
@ -26,10 +26,10 @@ When no state changes have occured for DEBOUNCE milliseconds, we push the state.
 | 
				
			|||||||
static bool debouncing = false;
 | 
					static bool debouncing = false;
 | 
				
			||||||
static uint16_t debouncing_time;
 | 
					static uint16_t debouncing_time;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void debounce_init(void) {}
 | 
					void debounce_init(uint8_t num_rows) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if DEBOUNCE > 0
 | 
					#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) {
 | 
					  if (changed) {
 | 
				
			||||||
    debouncing = true;
 | 
					    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) {
 | 
					  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];
 | 
					      cooked[i] = raw[i];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    debouncing = false;
 | 
					    debouncing = false;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#else //no debouncing.
 | 
					#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++) {
 | 
					  for (int i = 0; i < MATRIX_ROWS; i++) {
 | 
				
			||||||
    cooked[i] = raw[i];
 | 
					    cooked[i] = raw[i];
 | 
				
			||||||
 | 
				
			|||||||
@ -122,7 +122,7 @@ void matrix_init(void) {
 | 
				
			|||||||
        raw_matrix[i] = 0;
 | 
					        raw_matrix[i] = 0;
 | 
				
			||||||
        matrix[i] = 0;
 | 
					        matrix[i] = 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    debounce_init();
 | 
					    debounce_init(MATRIX_ROWS);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    matrix_init_quantum();
 | 
					    matrix_init_quantum();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -143,7 +143,7 @@ uint8_t matrix_scan(void)
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  debounce(raw_matrix, matrix, changed);
 | 
					  debounce(raw_matrix, matrix, MATRIX_ROWS, changed);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  matrix_scan_quantum();
 | 
					  matrix_scan_quantum();
 | 
				
			||||||
  return 1;
 | 
					  return 1;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user