test

Fork of HCSR04 by TVZ Mechatronics Team

Revision:
7:e53b2476821e
Parent:
6:cf3e4e307d15
--- 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;
 }