Fork without short circuits
Fork of keypad by
No extra hardware is needed besides the wires and switches. The columns are outputs configured with open drain. The rows are inputs configured with pull up resistors. A key press pulls down its row. With scanning the column is determined thereafter.
See SaveKeypad for an example usage.
Revision 15:873a9a452ef1, committed 2012-11-04
- Comitter:
- gj_schoneveld
- Date:
- Sun Nov 04 09:56:24 2012 +0000
- Parent:
- 14:f6c3647bf421
- Child:
- 16:a9feaa7ac039
- Commit message:
- variable i not needed
Changed in this revision
keypad.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/keypad.cpp Sun Nov 04 09:53:46 2012 +0000 +++ b/keypad.cpp Sun Nov 04 09:56:24 2012 +0000 @@ -101,15 +101,12 @@ int Keypad::ScanMultiple() { int res = 0; - - int i = 0; for (int c = 0; c < col_count; c++) { _cols = ~(1 << c); for (int r = 0; r < row_count; r++) { if (*_rows[r] == 0) { res |= 1 << (r * col_count + c); } - i++; } }