3#include <condition_variable>
76 void init(uint8_t index);
78 void recalculateLastDistanceLocked();
79 void onMeasuringDone(
const CoprocStat_UltrasoundStat& result);
84 uint32_t m_lastDistanceMm;
87 std::vector<callback_t> m_callbacks;
88 std::recursive_mutex m_mutex;
89 std::condition_variable_any m_measuringDone;
90 uint16_t m_timeoutTimer;
The main library class for working with the RBCX board. Call the install() method at the start of you...
Definition: RBCXManager.h:61
Definition: RBCXUltrasound.h:17
void setSpeedOfSound(float speedOfSoundInMetersPerSecond=defaultSpeedOfSound)
Set the speed of sound in m/s.
Definition: RBCXUltrasound.cpp:33
void measureAsync(callback_t callback=nullptr)
Asynchronously measure the distance to an object. The callback will be called when the measurement is...
Definition: RBCXUltrasound.cpp:40
std::function< bool(uint32_t)> callback_t
Definition: RBCXUltrasound.h:24
float getSpeedOfSound() const
Get the speed of sound in m/s.
Definition: RBCXUltrasound.h:55
bool isLastMeasurementValid() const
Returns true if the last measurement was valid Tests if the last measurement was`nt 0.
Definition: RBCXUltrasound.h:45
static constexpr float defaultSpeedOfSound
< Default is speed at 25C, 50%, 101 kPa
Definition: RBCXUltrasound.h:22
uint32_t lastDurationUs() const
Get the last measured duration in us. If the last measurement was invalid or not yet done,...
Definition: RBCXUltrasound.h:38
uint32_t lastDistanceMm() const
Get the last measured distance in mm. If the last measurement was invalid or not yet done,...
Definition: RBCXUltrasound.h:31
uint32_t measure()
Synchronously measure the distance to an object. This function will block until the measurement is do...
Definition: RBCXUltrasound.cpp:61
Definition: RBCXAngle.cpp:3