# HG changeset patch # User Jacob Alexander # Date 1300751383 25200 # Node ID 102b7ec2ce6b382461622639e4c288bc7ba3999c # Parent 1e71d8e523922864611634f8740a8d77038a8c11 Adding array sizes (fixing the extra key problem) diff -r 1e71d8e52392 -r 102b7ec2ce6b main.c --- a/main.c Mon Mar 21 16:06:01 2011 -0700 +++ b/main.c Mon Mar 21 16:49:43 2011 -0700 @@ -334,8 +334,8 @@ PORTF = 0xFF; } -void keyPressDetection( uint8_t *keys, uint8_t *validKeys) { - for ( uint8_t key = 0; key < KEYBOARD_SIZE + 1; key++ ) { +void keyPressDetection( uint8_t *keys, uint8_t *validKeys, uint8_t numberOfKeys ) { + for ( uint8_t key = 0; key < numberOfKeys + 1; key++ ) { if ( keys[key] & (1 << 7) ) { pint8( key ); print(" "); @@ -431,8 +431,8 @@ // Detect Valid Keypresses - TODO uint8_t validKeys = 0; - keyPressDetection( keyDetectArray, &validKeys ); - keyPressDetection( keypadDetectArray, &validKeys ); + keyPressDetection( keyDetectArray, &validKeys, KEYBOARD_SIZE ); + keyPressDetection( keypadDetectArray, &validKeys, KEYPAD_SIZE ); print(":\n"); // TODO undo potentially old keys