Mercurial > louis > kiibohd-controller
changeset 9:102b7ec2ce6b
Adding array sizes (fixing the extra key problem)
author | Jacob Alexander <triplehaata@gmail.com> |
---|---|
date | Mon, 21 Mar 2011 16:49:43 -0700 |
parents | 1e71d8e52392 |
children | f35ea5de4456 |
files | main.c |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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