Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
SimpleTimer functions

Provides basic OS timer functions. More...

 SimpleTimer::SimpleTimer ()
 OSTimer class. More...
 
 Timer::Timer ()
 Timer class. More...
 
Timer &IRAM_ATTR Timer::initializeMs (uint32_t milliseconds, InterruptCallback callback=nullptr)
 Initialise millisecond timer. More...
 
Timer &IRAM_ATTR Timer::initializeUs (uint32_t microseconds, InterruptCallback callback=nullptr)
 Initialise microsecond timer. More...
 
Timer &IRAM_ATTR Timer::initializeMs (uint32_t milliseconds, TimerDelegate delegateFunction=nullptr) SMING_DEPRECATED
 Initialise millisecond timer. More...
 
Timer &IRAM_ATTR Timer::initializeUs (uint32_t microseconds, TimerDelegate delegateFunction=nullptr) SMING_DEPRECATED
 Initialise microsecond timer. More...
 
Timer &IRAM_ATTR Timer::initializeMs (uint32_t milliseconds, TimerDelegateStdFunction delegateFunction=nullptr)
 Initialise millisecond timer. More...
 
Timer &IRAM_ATTR Timer::initializeUs (uint32_t microseconds, TimerDelegateStdFunction delegateFunction=nullptr)
 Initialise microsecond timer. More...
 
void IRAM_ATTR Timer::start (bool repeating=true)
 Start timer running. More...
 
__forceinline void IRAM_ATTR Timer::startOnce ()
 Start one-shot timer running. More...
 
void IRAM_ATTR Timer::stop ()
 Stop timer. More...
 
__forceinline void IRAM_ATTR Timer::restart ()
 Restarts timer. More...
 
bool Timer::isStarted ()
 Check if timer is started. More...
 
uint64_t Timer::getIntervalUs ()
 Get timer interval. More...
 
uint32_t Timer::getIntervalMs ()
 Get timer interval. More...
 
void IRAM_ATTR Timer::setIntervalUs (uint64_t microseconds=1000000)
 Set timer interval. More...
 
void IRAM_ATTR Timer::setIntervalMs (uint32_t milliseconds=1000000)
 Set timer interval. More...
 
void IRAM_ATTR Timer::setCallback (InterruptCallback interrupt=nullptr)
 Set timer trigger function. More...
 
void IRAM_ATTR Timer::setCallback (TimerDelegate delegateFunction)
 Set timer trigger function. More...
 
void IRAM_ATTR Timer::setCallback (const TimerDelegateStdFunction &delegateFunction)
 Set timer trigger function. More...
 
void IRAM_ATTR Timer::processing ()
 
void Timer::tick ()
 virtual timer loop() method More...
 

Detailed Description

Provides basic OS timer functions.

Provides timer functions.

Function Documentation

uint32_t Timer::getIntervalMs ( )
inline

Get timer interval.

Return values
uint32_tTimer interval in milliseconds
uint64_t Timer::getIntervalUs ( )
inline

Get timer interval.

Return values
uint64_tTimer interval in microseconds
Timer& IRAM_ATTR Timer::initializeMs ( uint32_t  milliseconds,
InterruptCallback  callback = nullptr 
)

Initialise millisecond timer.

Parameters
millisecondsDuration of timer in milliseconds
callbackFunction to call when timer triggers
Note
Classic c-style callback method
Timer& IRAM_ATTR Timer::initializeMs ( uint32_t  milliseconds,
TimerDelegate  delegateFunction = nullptr 
)

Initialise millisecond timer.

Parameters
millisecondsDuration of timer in milliseconds
delegateFunctionFunction to call when timer triggers
Note
Delegate callback method
Deprecated:
Use initializeMs(uint32_t, TimerDelegateStdFunction) instead
Timer& IRAM_ATTR Timer::initializeMs ( uint32_t  milliseconds,
TimerDelegateStdFunction  delegateFunction = nullptr 
)

Initialise millisecond timer.

Parameters
millisecondsDuration of timer in milliseconds
delegateFunctionFunction to call when timer triggers
Note
Delegate callback method
Timer& IRAM_ATTR Timer::initializeUs ( uint32_t  microseconds,
InterruptCallback  callback = nullptr 
)

Initialise microsecond timer.

Parameters
microsecondsDuration of timer in milliseconds
callbackFunction to call when timer triggers
Note
Classic c-style callback method
Timer& IRAM_ATTR Timer::initializeUs ( uint32_t  microseconds,
TimerDelegate  delegateFunction = nullptr 
)

Initialise microsecond timer.

Parameters
microsecondsDuration of timer in milliseconds
delegateFunctionFunction to call when timer triggers
Note
Delegate callback method
Deprecated:
Use initializeMs(uint32_t, TimerDelegateStdFunction) instead
Timer& IRAM_ATTR Timer::initializeUs ( uint32_t  microseconds,
TimerDelegateStdFunction  delegateFunction = nullptr 
)

Initialise microsecond timer.

Parameters
microsecondsDuration of timer in milliseconds
delegateFunctionFunction to call when timer triggers
Note
Delegate callback method
bool Timer::isStarted ( )
inline

Check if timer is started.

Return values
boolTrue if timer is running
__forceinline void IRAM_ATTR Timer::restart ( )
inline

Restarts timer.

Note
Restarts the timer from zero, extending duration.
void IRAM_ATTR Timer::setCallback ( InterruptCallback  interrupt = nullptr)

Set timer trigger function.

Parameters
interruptFunction to be called on timer trigger
Note
Classic c-type callback method
void IRAM_ATTR Timer::setCallback ( TimerDelegate  delegateFunction)

Set timer trigger function.

Parameters
delegateFunctionFunction to be called on timer trigger
Note
Delegate callback method
void IRAM_ATTR Timer::setCallback ( const TimerDelegateStdFunction &  delegateFunction)

Set timer trigger function.

Parameters
delegateFunctionFunction to be called on timer trigger
Note
Delegate callback method
void IRAM_ATTR Timer::setIntervalMs ( uint32_t  milliseconds = 1000000)

Set timer interval.

Parameters
millisecondsInterval in milliseconds. (Default: 1s)
void IRAM_ATTR Timer::setIntervalUs ( uint64_t  microseconds = 1000000)

Set timer interval.

Parameters
microsecondsInterval in microseconds. (Default: 1ms)
SimpleTimer::SimpleTimer ( )
inline

OSTimer class.

void IRAM_ATTR Timer::start ( bool  repeating = true)

Start timer running.

Parameters
repeatingSet to true for repeating timer. Set to false for one-shot.
__forceinline void IRAM_ATTR Timer::startOnce ( )
inline

Start one-shot timer running.

Note
Will start timer and trigger once after configured duration.
void IRAM_ATTR Timer::stop ( )

Stop timer.

Note
Stops a running timer. Has no effect on stopped timer.
void Timer::tick ( )
protected

virtual timer loop() method

Note
Can be override in class derivations. If overwriten, no classic other callbacks are working.
Timer::Timer ( )
inline

Timer class.