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.
Dependents: Nucleo_UltrasonicHelloWorld xxx_Sonar-HC-SR04_Lsg
Diff: ultrasonic.h
- Revision:
- 5:6fd0e9c7ead4
- Parent:
- 2:cc1143d36567
- Child:
- 6:9808e2c61247
diff -r e0f9c9fb4cf3 -r 6fd0e9c7ead4 ultrasonic.h
--- 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