distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
distortos::SoftwareTimerCommon Class Reference

SoftwareTimerCommon class implements common functionality of software timers. More...

#include "distortos/SoftwareTimerCommon.hpp"

Inheritance diagram for distortos::SoftwareTimerCommon:
[legend]
Collaboration diagram for distortos::SoftwareTimerCommon:
[legend]

Public Member Functions

constexpr SoftwareTimerCommon ()
 SoftwareTimerCommon's constructor. More...
 
 ~SoftwareTimerCommon () override
 SoftwareTimerCommon's destructor. More...
 
bool isRunning () const override
 
int start (TickClock::time_point timePoint, TickClock::duration period={}) override
 Starts the timer. More...
 
int stop () override
 Stops the timer. More...
 
 SoftwareTimerCommon (const SoftwareTimerCommon &)=delete
 
 SoftwareTimerCommon (SoftwareTimerCommon &&)=default
 
const SoftwareTimerCommonoperator= (const SoftwareTimerCommon &)=delete
 
SoftwareTimerCommonoperator= (SoftwareTimerCommon &&)=delete
 
int start (TickClock::duration duration, TickClock::duration period={})
 Starts the timer. More...
 
template<typename Rep1 , typename Period1 , typename Rep2 = TickClock::rep, typename Period2 = TickClock::period>
int start (const std::chrono::duration< Rep1, Period1 > duration, const std::chrono::duration< Rep2, Period2 > period={})
 Starts the timer. More...
 
virtual int start (TickClock::time_point timePoint, TickClock::duration period={})=0
 Starts the timer. More...
 
template<typename Duration , typename Rep = TickClock::rep, typename Period = TickClock::period>
int start (const std::chrono::time_point< TickClock, Duration > timePoint, const std::chrono::duration< Rep, Period > period={})
 Starts the timer. More...
 
- Public Member Functions inherited from distortos::SoftwareTimer
virtual ~SoftwareTimer ()=default
 SoftwareTimer's destructor. More...
 
int start (TickClock::duration duration, TickClock::duration period={})
 Starts the timer. More...
 
template<typename Rep1 , typename Period1 , typename Rep2 = TickClock::rep, typename Period2 = TickClock::period>
int start (const std::chrono::duration< Rep1, Period1 > duration, const std::chrono::duration< Rep2, Period2 > period={})
 Starts the timer. More...
 
template<typename Duration , typename Rep = TickClock::rep, typename Period = TickClock::period>
int start (const std::chrono::time_point< TickClock, Duration > timePoint, const std::chrono::duration< Rep, Period > period={})
 Starts the timer. More...
 

Private Attributes

internal::SoftwareTimerControlBlock softwareTimerControlBlock_
 internal SoftwareTimerControlBlock object More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from distortos::SoftwareTimer
static void softwareTimerRunner (SoftwareTimer &softwareTimer)
 Software timer's function runner. More...
 

Detailed Description

SoftwareTimerCommon class implements common functionality of software timers.

Constructor & Destructor Documentation

◆ SoftwareTimerCommon()

constexpr distortos::SoftwareTimerCommon::SoftwareTimerCommon ( )
inline

SoftwareTimerCommon's constructor.

Here is the call graph for this function:

◆ ~SoftwareTimerCommon()

distortos::SoftwareTimerCommon::~SoftwareTimerCommon ( )
override

SoftwareTimerCommon's destructor.

Member Function Documentation

◆ isRunning()

bool distortos::SoftwareTimerCommon::isRunning ( ) const
overridevirtual
Returns
true if the timer is running, false otherwise

Implements distortos::SoftwareTimer.

Here is the call graph for this function:

◆ start() [1/5]

int distortos::SoftwareTimerCommon::start ( TickClock::time_point  timePoint,
TickClock::duration  period = {} 
)
overridevirtual

Starts the timer.

Parameters
[in]timePointis the time point at which the function will be executed
[in]periodis the period used to restart repetitive software timer, 0 for one-shot software timers, default - 0
Returns
0 on success, error code otherwise

Implements distortos::SoftwareTimer.

Here is the call graph for this function:

◆ start() [2/5]

template<typename Rep1 , typename Period1 , typename Rep2 = TickClock::rep, typename Period2 = TickClock::period>
int distortos::SoftwareTimer::start ( typename Rep1  ,
typename Period1  ,
typename Rep2  = TickClock::rep,
typename Period2  = TickClock::period 
)
inline

Starts the timer.

Note
The duration must not be shorter, so one additional tick is always added to the duration.
Template Parameters
Rep1is type of tick counter used in duration
Period1is std::ratio type representing the tick period of the clock used in duration, seconds
Rep2is type of tick counter used in period
Period2is std::ratio type representing the tick period of the clock used in period, seconds
Parameters
[in]durationis the duration after which the function will be executed
[in]periodis the period used to restart repetitive software timer, 0 for one-shot software timers, default - 0
Returns
0 on success, error code otherwise

◆ start() [3/5]

template<typename Duration , typename Rep = TickClock::rep, typename Period = TickClock::period>
int distortos::SoftwareTimer::start ( typename Duration  ,
typename Rep  = TickClock::rep,
typename Period  = TickClock::period 
)
inline

Starts the timer.

Template Parameters
Durationis a std::chrono::duration type used to measure duration
Repis type of tick counter used in period
Periodis std::ratio type representing the tick period of the clock used in period, seconds
Parameters
[in]timePointis the time point at which the function will be executed
[in]periodis the period used to restart repetitive software timer, 0 for one-shot software timers, default - 0
Returns
0 on success, error code otherwise

◆ start() [4/5]

virtual int distortos::SoftwareTimer::start

Starts the timer.

Parameters
[in]timePointis the time point at which the function will be executed
[in]periodis the period used to restart repetitive software timer, 0 for one-shot software timers, default - 0
Returns
0 on success, error code otherwise

◆ start() [5/5]

int distortos::SoftwareTimer::start

Starts the timer.

Note
The duration will never be shorter, so one additional tick is always added to the duration.
Parameters
[in]durationis the duration after which the function will be executed
[in]periodis the period used to restart repetitive software timer, 0 for one-shot software timers, default - 0
Returns
0 on success, error code otherwise

◆ stop()

int distortos::SoftwareTimerCommon::stop ( )
overridevirtual

Stops the timer.

Returns
0 on success, error code otherwise

Implements distortos::SoftwareTimer.

Here is the call graph for this function:

Member Data Documentation

◆ softwareTimerControlBlock_

internal::SoftwareTimerControlBlock distortos::SoftwareTimerCommon::softwareTimerControlBlock_
private

internal SoftwareTimerControlBlock object


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