#include <RBCXUltrasound.h>
|
uint32_t | lastDistanceMm () const |
| Get the last measured distance in mm. If the last measurement was invalid or not yet done, returns 0. More...
|
|
uint32_t | lastDurationUs () const |
| Get the last measured duration in us. If the last measurement was invalid or not yet done, returns 0. More...
|
|
bool | isLastMeasurementValid () const |
| Returns true if the last measurement was valid Tests if the last measurement was`nt 0. More...
|
|
void | setSpeedOfSound (float speedOfSoundInMetersPerSecond=defaultSpeedOfSound) |
| Set the speed of sound in m/s. More...
|
|
float | getSpeedOfSound () const |
| Get the speed of sound in m/s. More...
|
|
void | measureAsync (callback_t callback=nullptr) |
| Asynchronously measure the distance to an object. The callback will be called when the measurement is done. More...
|
|
uint32_t | measure () |
| Synchronously measure the distance to an object. This function will block until the measurement is done. More...
|
|
◆ callback_t
◆ getSpeedOfSound()
float rb::Ultrasound::getSpeedOfSound |
( |
| ) |
const |
|
inline |
Get the speed of sound in m/s.
◆ isLastMeasurementValid()
bool rb::Ultrasound::isLastMeasurementValid |
( |
| ) |
const |
|
inline |
Returns true if the last measurement was valid Tests if the last measurement was`nt 0.
- Returns
- bool
◆ lastDistanceMm()
uint32_t rb::Ultrasound::lastDistanceMm |
( |
| ) |
const |
|
inline |
Get the last measured distance in mm. If the last measurement was invalid or not yet done, returns 0.
- Returns
- uint32_t
◆ lastDurationUs()
uint32_t rb::Ultrasound::lastDurationUs |
( |
| ) |
const |
|
inline |
Get the last measured duration in us. If the last measurement was invalid or not yet done, returns 0.
- Returns
- uint32_t
◆ measure()
uint32_t rb::Ultrasound::measure |
( |
| ) |
|
Synchronously measure the distance to an object. This function will block until the measurement is done.
- Returns
- uint32_t
◆ measureAsync()
void rb::Ultrasound::measureAsync |
( |
callback_t |
callback = nullptr | ) |
|
Asynchronously measure the distance to an object. The callback will be called when the measurement is done.
- Parameters
-
callback | is a function which will be called when the measurement is done. |
◆ setSpeedOfSound()
void rb::Ultrasound::setSpeedOfSound |
( |
float |
speedOfSoundInMetersPerSecond = defaultSpeedOfSound | ) |
|
Set the speed of sound in m/s.
◆ Manager
◆ defaultSpeedOfSound
constexpr float rb::Ultrasound::defaultSpeedOfSound = 347.13f |
|
staticconstexpr |
< Default is speed at 25C, 50%, 101 kPa
The documentation for this class was generated from the following files: