FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
|
An abstract base class for some sonar classes defined as part of this API. More...
#include <fastarduino/devices/sonar.h>
Public Types | |
using | RTT = timer::RTT< NTIMER_ > |
The type of timer::RTT used by this sonar instance. More... | |
Public Member Functions | |
bool | ready () const |
Indicate if an echo pulse measure is ready to read. More... | |
uint16_t | latest_echo_us () const |
Get the latest measured echo pulse duration. More... | |
An abstract base class for some sonar classes defined as part of this API.
You should not need to subclass AbstractSonar
yourself in general.
NTIMER_ | the AVR timer of the timer::RTT to use for this sonar |
using devices::sonar::AbstractSonar< NTIMER_ >::RTT = timer::RTT<NTIMER_> |
The type of timer::RTT
used by this sonar instance.
|
inline |
Indicate if an echo pulse measure is ready to read.
This can be useful when using asynchronous modes, and checking from time to time if, after a trigger pulse, an echo pulse has already been received or not yet.
true | an echo pulse duration is available |
false | an echo pulse duration is not yet available |
|
inline |
Get the latest measured echo pulse duration.
If a trigger pulse was sent but no echo received yet, then the method immediataly returns 0
. It also returns 0
, as a convention, if a timeout occurred, i.e. no echo pulse was received in expected time.