Synchronous and asynchronous library for ultrasonic distance measurement for the device HC-SR04 with error handling functionality (out of range detection, HW error detection). Main features: "echo" puls duration measurement, distance measurement from "echo" pulse duration, detection of "echo" signal malfunction, timeout detection, detection of measured values outside reliable limits (min, max)

Dependents:   TEST_Dist_lib

Revision:
1:a2bf338e3698
Parent:
0:4fbf332e6759
Child:
3:c516e180843e
--- a/Distance_HC_SR04.cpp	Mon Dec 21 21:01:53 2015 +0000
+++ b/Distance_HC_SR04.cpp	Mon Dec 21 21:19:03 2015 +0000
@@ -1,7 +1,8 @@
 #include "Distance_HC_SR04.h"
 
 
-    /** Create Distance_HC_SR04 instance
+    /** Create Distance_HC_SR04 instance. Set FSM to IDLE state.
+     *
      */
     Distance_HC_SR04::Distance_HC_SR04(PinName trig, PinName echo, uint32_t tout_us, float coeff,
             uint32_t tmin_us, uint32_t tmax_us) :
@@ -10,7 +11,8 @@
         _state = IDLE;
     }
 
-    /** Start the measurement.
+    /** Start the measurement. Starts the measurement (pulse on "trig" output) and checks proper value of "echo" signal.
+     *  Sets FSM to STARTED in case that "echo" reacts correctly. Otherwise ERROR_SIG state is being set.
      *
      */
     void Distance_HC_SR04::trigger(void) {