Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 11:75328ab1acf4, committed 2020-01-27
- Comitter:
- zhiyong
- Date:
- Mon Jan 27 05:15:16 2020 +0000
- Parent:
- 10:da060f8c03e8
- Commit message:
- Added PullDown to InterruptIn initialization so the code can work on STM32F4. Also removed debounce delay in ISR to work on mbed-os-5.; ; Tested working on customized boarded based on Arch_Max/STM32F407VET6.
Changed in this revision
| Keypad.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r da060f8c03e8 -r 75328ab1acf4 Keypad.cpp
--- a/Keypad.cpp Wed Jan 01 17:45:53 2014 +0000
+++ b/Keypad.cpp Mon Jan 27 05:15:16 2020 +0000
@@ -28,19 +28,19 @@
)
{
if (_rows[0]) {
- _rows[0]->rise(this, &Keypad::_cbRow0Rise);
+ _rows[0]->rise(callback(this, &Keypad::_cbRow0Rise));
}
if (_rows[1]) {
- _rows[1]->rise(this, &Keypad::_cbRow1Rise);
+ _rows[1]->rise(callback(this, &Keypad::_cbRow1Rise));
}
if (_rows[2]) {
- _rows[2]->rise(this, &Keypad::_cbRow2Rise);
+ _rows[2]->rise(callback(this, &Keypad::_cbRow2Rise));
}
if (_rows[3]) {
- _rows[3]->rise(this, &Keypad::_cbRow3Rise);
+ _rows[3]->rise(callback(this, &Keypad::_cbRow3Rise));
}
}
@@ -68,7 +68,9 @@
_nRow = 0;
for (int i = 0; i < 4; i++) {
if (rPins[i] != NC) {
- _rows[i] = new InterruptIn(rPins[i]);
+ // PullDown required, otherwise won't work on STM32F407, most likely not on other STM32 MCUs as well
+ // Without PullDown, InterruptIn seems to float
+ _rows[i] = new InterruptIn(rPins[i], PullDown);
_nRow++;
} else
break;
@@ -133,10 +135,12 @@
,InterruptIn *therow
)
{
+ // Blocking waiting not allowed by mbed-os-5
+ // Keypad seems to work fine without debounce
#ifdef THREAD_H
- Thread::wait(_debounce);
+ //Thread::wait(_debounce);
#else
- wait_ms(_debounce);
+ //wait_ms(_debounce);
#endif
if (therow->read() == 0)