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

#include <HardwareTimer.h>

Inheritance diagram for Hardware_Timer:
HardwareTimer

Public Member Functions

HardwareTimer &IRAM_ATTR initializeUs (uint32_t microseconds, InterruptCallback callback=nullptr)
 Initialise hardware timer. More...
 
HardwareTimer &IRAM_ATTR initializeMs (uint32_t milliseconds, InterruptCallback callback=nullptr)
 Initialise hardware timer. More...
 
bool IRAM_ATTR start (bool repeating=true)
 Start timer running. More...
 
__forceinline bool IRAM_ATTR startOnce ()
 Start one-shot timer. More...
 
void IRAM_ATTR stop ()
 Stops timer. More...
 
bool IRAM_ATTR restart ()
 Restart timer. More...
 
bool isStarted ()
 Check if timer is started. More...
 
uint32_t getIntervalUs ()
 Get timer interval. More...
 
uint32_t getIntervalMs ()
 Get timer interval. More...
 
bool IRAM_ATTR setIntervalUs (uint32_t microseconds)
 Set timer interval. More...
 
__forceinline bool IRAM_ATTR setIntervalMs (uint32_t milliseconds)
 Set timer interval. More...
 
void IRAM_ATTR setCallback (InterruptCallback callback)
 Set timer trigger callback. More...
 
__forceinline void IRAM_ATTR call ()
 Call timer callback. More...
 

Detailed Description

Deprecated:
Use HardwareTimer class instead

Member Function Documentation

__forceinline void IRAM_ATTR HardwareTimer::call ( )
inlineinherited

Call timer callback.

Note
Calls the timer callback function
uint32_t HardwareTimer::getIntervalMs ( )
inlineinherited

Get timer interval.

Return values
uint32_tTimer interval in milliseconds
uint32_t HardwareTimer::getIntervalUs ( )
inlineinherited

Get timer interval.

Return values
uint32_tTimer interval in microseconds
HardwareTimer& IRAM_ATTR HardwareTimer::initializeMs ( uint32_t  milliseconds,
InterruptCallback  callback = nullptr 
)
inherited

Initialise hardware timer.

Parameters
millisecondsTimer interval in milliseconds
callbackCallback function to call when timer triggers (Default: none)
Return values
HardwareTimer&Reference to timer
HardwareTimer& IRAM_ATTR HardwareTimer::initializeUs ( uint32_t  microseconds,
InterruptCallback  callback = nullptr 
)
inherited

Initialise hardware timer.

Parameters
microsecondsTimer interval in microseconds
callbackCallback function to call when timer triggers (Default: none)
Return values
HardwareTimer&Reference to timer
bool HardwareTimer::isStarted ( )
inlineinherited

Check if timer is started.

Return values
boolTrue if started
bool IRAM_ATTR HardwareTimer::restart ( )
inherited

Restart timer.

Return values
boolTrue if timer started
Note
Timer is stopped then started with current configuration
void IRAM_ATTR HardwareTimer::setCallback ( InterruptCallback  callback)
inherited

Set timer trigger callback.

Parameters
callbackFunction to call when timer triggers
__forceinline bool IRAM_ATTR HardwareTimer::setIntervalMs ( uint32_t  milliseconds)
inlineinherited

Set timer interval.

Parameters
millisecondsInterval time in milliseconds
bool IRAM_ATTR HardwareTimer::setIntervalUs ( uint32_t  microseconds)
inherited

Set timer interval.

Parameters
microsecondsInterval time in microseconds (Default: 1ms)
bool IRAM_ATTR HardwareTimer::start ( bool  repeating = true)
inherited

Start timer running.

Parameters
repeatingTrue to restart timer when it triggers, false for one-shot (Default: true)
Return values
boolTrue if timer started
__forceinline bool IRAM_ATTR HardwareTimer::startOnce ( )
inlineinherited

Start one-shot timer.

Return values
boolTrue if timer started
Note
Timer starts and will run for configured period then stop
void IRAM_ATTR HardwareTimer::stop ( )
inherited

Stops timer.