test

Fork of HCSR04 by TVZ Mechatronics Team

Files at this revision

API Documentation at this revision

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;
 }