15 #ifndef _SMING_CORE_HWTIMER_H_ 16 #define _SMING_CORE_HWTIMER_H_ 18 #include "../SmingCore/Interrupts.h" 19 #include "../SmingCore/Delegate.h" 21 #define MAX_HW_TIMER_INTERVAL_US 0x7fffff 22 #define MIN_HW_TIMER_INTERVAL_US 0x32 55 bool IRAM_ATTR
start(
bool repeating =
true);
67 bool IRAM_ATTR
stop();
93 bool IRAM_ATTR
setIntervalUs(uint32_t microseconds = 1000000);
98 bool IRAM_ATTR
setIntervalMs(uint32_t milliseconds = 1000000);
103 void IRAM_ATTR
setCallback(InterruptCallback callback);
108 void __forceinline IRAM_ATTR
call() {
116 uint32_t interval = 0;
117 InterruptCallback callback =
nullptr;
118 bool repeating =
false;
119 bool started =
false;
Hardware timer class.
Definition: HardwareTimer.h:29
void IRAM_ATTR setCallback(InterruptCallback callback)
Set timer trigger callback.
Hardware_Timer &IRAM_ATTR initializeUs(uint32_t microseconds, InterruptCallback callback=NULL)
Initialise hardware timer.
void __forceinline IRAM_ATTR call()
Call timer callback.
Definition: HardwareTimer.h:108
bool isStarted()
Check if timer is started.
uint32_t getIntervalMs()
Get timer interval.
bool IRAM_ATTR setIntervalMs(uint32_t milliseconds=1000000)
Set timer interval.
uint32_t getIntervalUs()
Get timer interval.
Hardware_Timer()
Hardware timer.
bool IRAM_ATTR setIntervalUs(uint32_t microseconds=1000000)
Set timer interval.
Delegate< void()> TimerDelegate
Delegate callback type for timer trigger.
Definition: HardwareTimer.h:26
bool IRAM_ATTR stop()
Stops timer.
bool IRAM_ATTR restart()
Restart timer.
Hardware_Timer &IRAM_ATTR initializeMs(uint32_t milliseconds, InterruptCallback callback=NULL)
Initialise hardware timer.
bool IRAM_ATTR start(bool repeating=true)
Start timer running.
bool __forceinline IRAM_ATTR startOnce()
Start one-shot timer.
Definition: HardwareTimer.h:61