Jan Kamidra / HC_SR04_Ultrasonic_Library

Dependents:   Nucleo_UltrasonicHelloWorld xxx_Sonar-HC-SR04_Lsg

Revision:
5:6fd0e9c7ead4
Parent:
2:cc1143d36567
Child:
6:9808e2c61247
--- a/ultrasonic.h	Mon Nov 24 20:23:07 2014 +0000
+++ b/ultrasonic.h	Thu Jun 10 18:45:59 2021 +0000
@@ -7,9 +7,9 @@
 {
     public:
         /**iniates the class with the specified trigger pin, echo pin, update speed and timeout**/
-        ultrasonic(PinName trigPin, PinName echoPin, float updateSpeed, float timeout);
+        ultrasonic(PinName trigPin, PinName echoPin, Kernel::Clock::duration_u32 updateSpeed, Kernel::Clock::duration_u32 timeout);
         /**iniates the class with the specified trigger pin, echo pin, update speed, timeout and method to call when the distance changes**/
-        ultrasonic(PinName trigPin, PinName echoPin, float updateSpeed, float timeout, void onUpdate(int));
+        ultrasonic(PinName trigPin, PinName echoPin, Kernel::Clock::duration_u32 updateSpeed, Kernel::Clock::duration_u32 timeout, void onUpdate(int));
         /** returns the last measured distance**/
         int getCurrentDistance(void);
         /**pauses measuring the distance**/
@@ -19,11 +19,11 @@
         /**attachs the method to be called when the distances changes**/
         void attachOnUpdate(void method(int));
         /**changes the speed at which updates are made**/
-        void changeUpdateSpeed(float updateSpeed);
+        void changeUpdateSpeed(Kernel::Clock::duration_u32 updateSpeed);
         /**gets whether the distance has been changed since the last call of isUpdated() or checkDistance()**/
         int isUpdated(void);
         /**gets the speed at which updates are made**/
-        float getUpdateSpeed(void);
+        Kernel::Clock::duration_u32 getUpdateSpeed(void);
         /**call this as often as possible in your code, eg. at the end of a while(1) loop,
         and it will check whether the method you have attached needs to be called**/
         void checkDistance(void);
@@ -33,7 +33,7 @@
         Timer _t;
         Timeout _tout;
         int _distance;
-        float _updateSpeed;
+        Kernel::Clock::duration_u32 _updateSpeed;
         int start;
         int end;
         volatile int done;
@@ -41,7 +41,7 @@
         void _startT(void);
         void _updateDist(void);
         void _startTrig(void);
-        float _timeout;
+        Kernel::Clock::duration_u32 _timeout;
         int d;
 };
 #endif
\ No newline at end of file