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.
Fork of HCSR04 by
Revision 7:e53b2476821e, committed 2017-11-25
- Comitter:
- tgw
- Date:
- Sat Nov 25 02:02:51 2017 +0000
- Parent:
- 6:cf3e4e307d15
- Commit message:
- test
Changed in this revision
HCSR04.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r cf3e4e307d15 -r e53b2476821e HCSR04.cpp --- a/HCSR04.cpp Sat Dec 10 08:26:18 2016 +0000 +++ b/HCSR04.cpp Sat Nov 25 02:02:51 2017 +0000 @@ -16,8 +16,9 @@ if (!timerStarted) { timer.start(); // start the timer timerStarted = true; - echoTimeout.attach_us(this, &HCSR04::stopTimer, 25000); // in case echo fall does not occur - echo.fall(this, &HCSR04::stopTimer); + //echoTimeout.attach_us(this, &HCSR04::stopTimer, 25000); // in case echo fall does not occur + echoTimeout.attach_us(callback(this, &HCSR04::stopTimer), 25000); // in case echo fall does not occur + echo.fall(callback(this, &HCSR04::stopTimer)); echo.rise(NULL); } } @@ -44,8 +45,8 @@ void HCSR04::startMeasurement() { trigger = 1; - triggerTimeout.attach_us(this, &HCSR04::turnOffTrigger, 10); - echo.rise(this, &HCSR04::startTimer); + triggerTimeout.attach_us(callback(this, &HCSR04::turnOffTrigger), 10); + echo.rise(callback(this, &HCSR04::startTimer)); newDataReady = false; }