SoftwareTimer class is an abstract interface for software timers.
More...
#include "distortos/SoftwareTimer.hpp"
|
virtual | ~SoftwareTimer ()=default |
| SoftwareTimer's destructor. More...
|
|
virtual bool | isRunning () const =0 |
|
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...
|
|
virtual int | stop ()=0 |
| Stops the timer. More...
|
|
|
virtual void | run ()=0 |
| "Run" function of software timer More...
|
|
SoftwareTimer class is an abstract interface for software timers.
◆ ~SoftwareTimer()
virtual distortos::SoftwareTimer::~SoftwareTimer |
( |
| ) |
|
|
virtualdefault |
◆ isRunning()
virtual bool distortos::SoftwareTimer::isRunning |
( |
| ) |
const |
|
pure virtual |
◆ run()
virtual void distortos::SoftwareTimer::run |
( |
| ) |
|
|
privatepure virtual |
◆ softwareTimerRunner()
void distortos::SoftwareTimer::softwareTimerRunner |
( |
SoftwareTimer & |
softwareTimer | ) |
|
|
staticprotected |
Software timer's function runner.
- Parameters
-
[in] | softwareTimer | is a reference to SoftwareTimer object that is being run |
◆ start() [1/4]
Starts the timer.
- Note
- The duration will never be shorter, so one additional tick is always added to the duration.
- Parameters
-
[in] | duration | is the duration after which the function will be executed |
[in] | period | is the period used to restart repetitive software timer, 0 for one-shot software timers, default - 0 |
- Returns
- 0 on success, error code otherwise
◆ start() [2/4]
template<typename Rep1 , typename Period1 , typename Rep2 = TickClock::rep, typename Period2 = TickClock::period>
int distortos::SoftwareTimer::start |
( |
const std::chrono::duration< Rep1, Period1 > |
duration, |
|
|
const std::chrono::duration< Rep2, Period2 > |
period = {} |
|
) |
| |
|
inline |
Starts the timer.
- Note
- The duration must not be shorter, so one additional tick is always added to the duration.
- Template Parameters
-
Rep1 | is type of tick counter used in duration |
Period1 | is std::ratio type representing the tick period of the clock used in duration, seconds |
Rep2 | is type of tick counter used in period |
Period2 | is std::ratio type representing the tick period of the clock used in period, seconds |
- Parameters
-
[in] | duration | is the duration after which the function will be executed |
[in] | period | is 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/4]
Starts the timer.
- Parameters
-
[in] | timePoint | is the time point at which the function will be executed |
[in] | period | is the period used to restart repetitive software timer, 0 for one-shot software timers, default - 0 |
- Returns
- 0 on success, error code otherwise
Implemented in distortos::SoftwareTimerCommon.
◆ start() [4/4]
template<typename Duration , typename Rep = TickClock::rep, typename Period = TickClock::period>
int distortos::SoftwareTimer::start |
( |
const std::chrono::time_point< TickClock, Duration > |
timePoint, |
|
|
const std::chrono::duration< Rep, Period > |
period = {} |
|
) |
| |
|
inline |
Starts the timer.
- Template Parameters
-
Duration | is a std::chrono::duration type used to measure duration |
Rep | is type of tick counter used in period |
Period | is std::ratio type representing the tick period of the clock used in period, seconds |
- Parameters
-
[in] | timePoint | is the time point at which the function will be executed |
[in] | period | is the period used to restart repetitive software timer, 0 for one-shot software timers, default - 0 |
- Returns
- 0 on success, error code otherwise
◆ stop()
virtual int distortos::SoftwareTimer::stop |
( |
| ) |
|
|
pure virtual |
The documentation for this class was generated from the following files: