avr-classes
Public Member Functions | List of all members
StopWatchTimer< COUNTERTYPE > Class Template Reference

#include <stopwatchtimer.h>

Inheritance diagram for StopWatchTimer< COUNTERTYPE >:
TimerService

Public Member Functions

 StopWatchTimer (void)
 
virtual void onTick (void) override
 
void reset (void)
 
COUNTERTYPE getValue (void) const
 
- Public Member Functions inherited from TimerService
 TimerService (void)
 
void start (void)
 
void stop (void)
 
bool isRunning (void) const
 

Detailed Description

template<class COUNTERTYPE>
class StopWatchTimer< COUNTERTYPE >

A StopWatchTimer is an upcounting timer that can be started, stopped and reset to zero. The current timer value can be queried at any time. The value silently flows over when its maximum is reached. The StopWatchTimer needs to be added to a TimerServiceHost instance. The base tick frequency of the TimerServiceHost specifies the rate at which the timer value is incremented.

Parameters
COUNTERTYPEData type for timeout value, e.g. uint16_t.

Constructor & Destructor Documentation

◆ StopWatchTimer()

template<class COUNTERTYPE >
StopWatchTimer< COUNTERTYPE >::StopWatchTimer ( void  )
inline

Constructor.

Member Function Documentation

◆ getValue()

template<class COUNTERTYPE >
COUNTERTYPE StopWatchTimer< COUNTERTYPE >::getValue ( void  ) const
inline

Gets the current timer value.

Returns
Current timer value

◆ onTick()

template<class COUNTERTYPE >
virtual void StopWatchTimer< COUNTERTYPE >::onTick ( void  )
inlineoverridevirtual

Callback for base tick events of TimerServiceHost. Called from ISR context.

Implements TimerService.

◆ reset()

template<class COUNTERTYPE >
void StopWatchTimer< COUNTERTYPE >::reset ( void  )
inline

Resets the timeout value to zero.