changeset 437:da28cecc0b5b

Merge pull request #114 from kiibohd/revert-113-ghost_fix Revert "Fixed ghosting matrix check (did send bad keys on release), now using…"
author Jacob Alexander <haata@kiibohd.com>
date Fri, 13 May 2016 14:38:46 -0700
parents d4388d80d651 (current diff) ac7a07c54b70 (diff)
children f10c2dad7f55
files
diffstat 1 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Scan/MatrixARM/matrix_scan.c	Fri May 13 11:37:39 2016 -0700
+++ b/Scan/MatrixARM/matrix_scan.c	Fri May 13 14:38:46 2016 -0700
@@ -80,7 +80,6 @@
 
 uint8_t col_use[Matrix_colsNum], row_use[Matrix_rowsNum];  // used count
 uint8_t col_ghost[Matrix_colsNum], row_ghost[Matrix_rowsNum];  // marked as having ghost if 1
-uint8_t col_ghost_old[Matrix_colsNum], row_ghost_old[Matrix_rowsNum];  // old ghost state
 #endif
 
 
@@ -212,18 +211,12 @@
 	for ( uint8_t pin = 0; pin < Matrix_colsNum; pin++ )
 	{
 		Matrix_pin( Matrix_cols[ pin ], Type_StrobeSetup );
-		col_use[pin] = 0;
-		col_ghost[pin] = 0;
-		col_ghost_old[pin] = 0;
 	}
 
 	// Setup Sense Pins
 	for ( uint8_t pin = 0; pin < Matrix_rowsNum; pin++ )
 	{
 		Matrix_pin( Matrix_rows[ pin ], Type_SenseSetup );
-		row_use[pin] = 0;
-		row_ghost[pin] = 0;
-		row_ghost_old[pin] = 0;
 	}
 
 	// Clear out Debounce Array
@@ -455,6 +448,7 @@
 	// strobe = column, sense = row
 
 	// Count (rows) use for columns
+	//print("C ");
 	for ( uint8_t col = 0; col < Matrix_colsNum; col++ )
 	{
 		uint8_t used = 0;
@@ -465,12 +459,13 @@
 			if ( keyOn(state->curState) )
 				used++;
 		}
+		//printInt8(used);
 		col_use[col] = used;
-		col_ghost_old[col] = col_ghost[col];
 		col_ghost[col] = 0;  // clear
 	}
 
 	// Count (columns) use for rows
+	//print("  R ");
 	for ( uint8_t row = 0; row < Matrix_rowsNum; row++ )
 	{
 		uint8_t used = 0;
@@ -481,13 +476,14 @@
 			if ( keyOn(state->curState) )
 				used++;
 		}
+		//printInt8(used);
 		row_use[row] = used;
-		row_ghost_old[row] = row_ghost[row];
 		row_ghost[row] = 0;  // clear
 	}
 
 	// Check if matrix has ghost
 	// Happens when key is pressed and some other key is pressed in same row and another in same column
+	//print("  G ");
 	for ( uint8_t col = 0; col < Matrix_colsNum; col++ )
 	{
 		for ( uint8_t row = 0; row < Matrix_rowsNum; row++ )
@@ -499,9 +495,11 @@
 				// mark col and row as having ghost
 				col_ghost[col] = 1;
 				row_ghost[row] = 1;
+				//print(" ");  printInt8(col);  print(",");  printInt8(row);
 			}
 		}
 	}
+	//print( NL );
 
 	// Send keys
 	for ( uint8_t col = 0; col < Matrix_colsNum; col++ )
@@ -514,8 +512,6 @@
 
 			// col or row is ghosting (crossed)
 			uint8_t ghost = (col_ghost[col] > 0 || row_ghost[row] > 0) ? 1 : 0;
-			uint8_t ghost_old = (col_ghost_old[col] > 0 || row_ghost_old[row] > 0) ? 1 : 0;
-			ghost = ghost || ghost_old ? 1 : 0;
 
 			st->prev = st->cur;  // previous
 			// save state if no ghost or outside ghosted area