FastArduino  v1.8
C++ library to build fast but small Arduino/AVR projects
timer::RTTRawTime< T > Class Template Reference

Utility class to avoid costly instantiation of time::RTTTime from an interrupt routine. More...

#include <fastarduino/realtime_timer.h>

Public Member Functions

 RTTRawTime (const RTTRawTime< T > &)=default
 
RTTRawTime< T > & operator= (const RTTRawTime< T > &)=default
 
 RTTRawTime (uint32_t millis, T counter, T max_counter)
 Create a new RTTRawTime from millis milliseconds, and values from Timer counter value that will allow microseconds calculation later on. More...
 
time::RTTTime as_real_time () const
 Convert this RTTRawTime instance to a fully usable time::RTTTime. More...
 

Static Public Attributes

static constexpr RTTRawTime< T > EMPTY_TIME {}
 A constant to signify "no time". More...
 

Detailed Description

template<typename T>
class timer::RTTRawTime< T >

Utility class to avoid costly instantiation of time::RTTTime from an interrupt routine.

It can be later (outside an ISR) converted into a real time::RTTTime.

It is usually created from raw Timer registers values. This type shall usually not be directly used as RTTRawTime<T> but actually obtained from an RTT<NTIMER> instance, as RTT::RAW_TIME.

Template Parameters
Tthe type of registers for the Timer providing raw values, either uint8_t or uint16_t
See also
time::RTTTime
RTT::RAW_TIME

Definition at line 135 of file realtime_timer.h.

Constructor & Destructor Documentation

◆ RTTRawTime()

template<typename T >
timer::RTTRawTime< T >::RTTRawTime ( uint32_t  millis,
counter,
max_counter 
)
inline

Create a new RTTRawTime from millis milliseconds, and values from Timer counter value that will allow microseconds calculation later on.

Parameters
millisthe milliseconds elapsed as accounted by an RTT instance
counterthe counter of the Timer used by the RTT instance
max_counterthe maximum counter value for the Timer

Definition at line 150 of file realtime_timer.h.

Member Function Documentation

◆ as_real_time()

template<typename T >
time::RTTTime timer::RTTRawTime< T >::as_real_time ( ) const
inline

Convert this RTTRawTime instance to a fully usable time::RTTTime.

This method performs potentially costly computation and hence should not be used inside an ISR.

Definition at line 165 of file realtime_timer.h.

Member Data Documentation

◆ EMPTY_TIME

template<typename T >
constexpr RTTRawTime<T> timer::RTTRawTime< T >::EMPTY_TIME {}
staticconstexpr

A constant to signify "no time".

This constant takes no code to build, compared with RTTRawTime{0, 0, 0}.

Definition at line 158 of file realtime_timer.h.


The documentation for this class was generated from the following file: