|
Sound Byte Libs 1ee2ca6
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
Generic interrupt-driven interval timer. More...
#include <interval_timer.hpp>
Public Member Functions | |
| IntervalTimer (uint32_t timer_instance) | |
| Construct interval timer. | |
| void | setIntervalMicros (uint32_t interval_us) |
| Set interval in microseconds. | |
| uint32_t | getIntervalMicros () const |
| Get current interval in microseconds. | |
| void | start () |
| Start the interval timer. | |
| void | stop () |
| Stop the interval timer. | |
| bool | isRunning () const |
| Check if timer is running. | |
| bool | hasTriggered () |
| Check if interval has triggered. | |
| void | handleTimerInterrupt () |
| Timer interrupt handler - call from ISR. | |
| IntervalTimer (uint32_t interval_ms) | |
| Constructor with interval period. | |
| void | start () |
| Start the interval timer. | |
| bool | tick () |
| Check if interval has elapsed and auto-reset. | |
| void | stop () |
| Stop the interval timer. | |
| void | setInterval (uint32_t interval_ms) |
| Update interval period. | |
| uint32_t | getInterval () const |
| Get current interval. | |
Generic interrupt-driven interval timer.
Interval timer for periodic tasks.
Provides precise interval timing using hardware timer interrupts. No musical or domain-specific logic - just generic interval generation. Applications convert their domain values (BPM, frequencies) to microseconds.
Usage:
| TimerImpl | Hardware timer implementation |
Similar to NonBlockingDelay but automatically resets after each period. Useful for periodic tasks like blinking LEDs, sampling sensors, etc.
| SystemTimeImpl | HAL system time implementation |
Definition at line 38 of file interval_timer.hpp.
|
inlineexplicit |
Construct interval timer.
| timer_instance | Hardware timer instance to use |
Definition at line 44 of file interval_timer.hpp.
|
inlineexplicit |
Constructor with interval period.
| interval_ms | Interval period in milliseconds |
Definition at line 115 of file non_blocking_delay.hpp.
|
inline |
Get current interval.
Definition at line 160 of file non_blocking_delay.hpp.
|
inline |
Get current interval in microseconds.
Definition at line 76 of file interval_timer.hpp.
|
inline |
Timer interrupt handler - call from ISR.
Called automatically via interrupt registry. Just sets internal flag - no callbacks or complex logic in ISR.
Definition at line 162 of file interval_timer.hpp.
|
inline |
Check if interval has triggered.
This is a one-shot check - returns true once per trigger. Call from main loop for event handling.
Definition at line 148 of file interval_timer.hpp.
|
inline |
Check if timer is running.
Definition at line 137 of file interval_timer.hpp.
|
inline |
Update interval period.
| interval_ms | New interval in milliseconds |
Definition at line 152 of file non_blocking_delay.hpp.
|
inline |
Set interval in microseconds.
| interval_us | Interval duration in microseconds |
Generic timing - no domain-specific logic. Applications convert their values to microseconds:
Definition at line 62 of file interval_timer.hpp.
|
inline |
Start the interval timer.
Definition at line 83 of file interval_timer.hpp.
|
inline |
Start the interval timer.
Definition at line 121 of file non_blocking_delay.hpp.
|
inline |
Stop the interval timer.
Definition at line 114 of file interval_timer.hpp.
|
inline |
Stop the interval timer.
Definition at line 144 of file non_blocking_delay.hpp.
|
inline |
Check if interval has elapsed and auto-reset.
Definition at line 130 of file non_blocking_delay.hpp.