Added hold down fix and debouncing(kinda)
Revision 22:9ebfd71933e9, committed 2019-02-15
- Comitter:
- baet6458
- Date:
- Fri Feb 15 02:00:02 2019 +0000
- Parent:
- 21:fb28bc08ded4
- Commit message:
- update library to handle hold downs and debouncing
Changed in this revision
keypad.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/keypad.cpp Sun Sep 20 06:00:00 2015 +0000 +++ b/keypad.cpp Fri Feb 15 02:00:02 2019 +0000 @@ -55,9 +55,13 @@ //Scan rows and cols and return switch index for(int i=0; i<4; i++) { _rows = ~(0x01 << i); - for(int j=0; j<4; j++) - if ( !( (_cols.read()>> j )& 0x1 )) + for(int j=0; j<4; j++){ + if ( !( (_cols.read()>> j )& 0x1 )){ + while ( !( (_cols.read()>> j )& 0x1 )){ + } return j + (i*4); + } + } } return -1; }