FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
|
This type holds information about events occurring within MultiHCSR04
handler.
More...
#include <fastarduino/devices/sonar.h>
Public Types | |
using | RTT = timer::RTT< NTIMER_ > |
The type of timer::RTT used by the MultiHCSR04 producing this SonarEvent . More... | |
using | RAW_TIME = typename RTT::RAW_TIME |
The timer::RTTRawTime type used by the MultiHCSR04 producing this SonarEvent . More... | |
Public Member Functions | |
SonarEvent () | |
Default constructor. More... | |
bool | timeout () const |
Indicate if this event was produced by a timeout while waiting for echo pulses. More... | |
uint8_t | started () const |
Indicate if this event was produced due to an echo pulse leading edge just received by the related MultiHCSR04 . More... | |
uint8_t | ready () const |
Indicate if this event was produced tdue to an echo pulse trailing edge just received by the related MultiHCSR04 . More... | |
RAW_TIME | time () const |
The timer::RTTRawTime at which this event occurred. More... | |
Friends | |
template<board::Timer , board::DigitalPin , board::Port , uint8_t > | |
class | MultiHCSR04 |
This type holds information about events occurring within MultiHCSR04
handler.
One event can contain information for up to 8 sonars.
You need to register callbacks to MultiHCSR04
in order to receive these events and process them. These events exist because MultiHCSR04
does not process them by itself i.e. it does not calculate or hold pulse information about all connected sonar sensors. It is the responsibility of callbacks to manage this information, based on all received SonarEvent
s.
NTIMER_ | the AVR timer of the timer::RTT used by the MultiHCSR04 producing this SonarEvent |
using devices::sonar::SonarEvent< NTIMER_ >::RTT = timer::RTT<NTIMER_> |
The type of timer::RTT
used by the MultiHCSR04
producing this SonarEvent
.
using devices::sonar::SonarEvent< NTIMER_ >::RAW_TIME = typename RTT::RAW_TIME |
The timer::RTTRawTime
type used by the MultiHCSR04
producing this SonarEvent
.
|
inline |
Default constructor.
This is here to allow direct declaration in your code:
|
inline |
Indicate if this event was produced by a timeout while waiting for echo pulses.
If so, no other field in this SonarEvent
is relevant. Hence this is the first method you should call on a SonarEvent
you need to handle.
|
inline |
Indicate if this event was produced due to an echo pulse leading edge just received by the related MultiHCSR04
.
Each bit maps to one sonar handled by the producing MultHCSR04
; when 1
, the echo pulse just started on the matching sonar. time()
will then provide the exact time at which the pulse egde occurred.
|
inline |
Indicate if this event was produced tdue to an echo pulse trailing edge just received by the related MultiHCSR04
.
Each bit maps to one sonar handled by the producing MultHCSR04
; when 1
, the echo pulse just ended on the matching sonar. time()
will then provide the exact time at which the pulse egde occurred. For a given bit (sonar), the difference of time()
between started()
and ready()
will determine the echo pulse duration.
|
inline |
|
friend |