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 8:632f53a272e8, committed 2022-11-29
- Comitter:
- thinesh
- Date:
- Tue Nov 29 07:34:05 2022 +0000
- Parent:
- 7:71da0dbf4400
- Commit message:
- Updated to Mbed OS 6
Changed in this revision
| hcsr04.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/hcsr04.cpp Sat Mar 30 18:55:03 2013 +0000
+++ b/hcsr04.cpp Tue Nov 29 07:34:05 2022 +0000
@@ -26,8 +26,8 @@
{
pulsetime.stop();
pulsetime.reset();
- echo.rise(this,&HCSR04::isr_rise);
- echo.fall(this,&HCSR04::isr_fall);
+ echo.rise(callback(this,&HCSR04::isr_rise)); //echo.rise(this,&HCSR04::isr_fall)
+ echo.fall(callback(this,&HCSR04::isr_fall)); //echo.fall(this,&HCSR04::isr_fall)
trigger=0;
}
@@ -49,7 +49,7 @@
void HCSR04::isr_fall(void)
{
pulsetime.stop();
- pulsedur = pulsetime.read_us();
+ pulsedur = (pulsetime.elapsed_time()).count(); //pulsetime.read_us();
distance= (pulsedur*343)/20000;
pulsetime.reset();
}