27 #ifndef _EASYUINO_DISTANCE_METER_NON_BLOCK_h 28 #define _EASYUINO_DISTANCE_METER_NON_BLOCK_h 30 #include "Utilities.h" 31 #include "DistanceMeter.h" 35 #define MAXIMUM_NUMBER_OF_DM_NON_BLOCK 2 54 bool _blockingMeasure;
58 bool _isDirtyDistance;
62 volatile bool _echoSent;
65 volatile unsigned long _lastTimeTrigger;
67 volatile unsigned long _lastTimeEcho;
116 #pragma region Interrupt Management/Handling Methods 118 void interruptHandler(IN
unsigned long interruptCallTimeMicros);
130 static void interruptCaller0();
131 static void interruptCaller1();
void executeUpdateDistanceNonBlock()
Execute a non-block distance measurement.
Used to represent the at least supported Ultrasonic Module models enum UltrasonicModule : uint8_t { H...
Definition: DistanceMeter.h:59
virtual void updateDistanceNonBlock()
Updates the distance of the Ultrasonic Module to the objects in a non-blocking way.
float calculateDistance(IN float soundSpeedCmPerSec)
Calculates the distance to the object based on the sound speed in air using the last distance value m...
void updateDistance()
Updates the distance of the Ultrasonic Module to the objects in a blocking way.
DistanceMeterNonBlock(IN uint8_t triggerPin, IN uint8_t echoPin)
Constructor.
void end()
Used to stop the device API.
DistanceMeterNonBlock offers an API to interact with an Ultrasonic Module to measure distance in a no...
Definition: DistanceMeterNonBlock.h:47
bool begin()
Used to put the device ready to receive requests.
float getDistanceCentimeters()
Gets the last value that the API measured using the Ultrasonic Module.
~DistanceMeterNonBlock()
Destructor.
bool isUpdateDistanceNonBlockTimeout()
Verify if there is a non-block measuremenet on going that has already timeouted.