Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Public Member Functions | List of all members
sbl::patterns::timing::IntervalTimer< SystemTimeImpl > Class Template Reference

Interval timer for periodic tasks. More...

#include <non_blocking_delay.hpp>

Collaboration diagram for sbl::patterns::timing::IntervalTimer< SystemTimeImpl >:

Public Member Functions

 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.
 

Detailed Description

template<typename SystemTimeImpl>
class sbl::patterns::timing::IntervalTimer< SystemTimeImpl >

Interval timer for periodic tasks.

Similar to NonBlockingDelay but automatically resets after each period. Useful for periodic tasks like blinking LEDs, sampling sensors, etc.

Template Parameters
SystemTimeImplHAL system time implementation
Note
All public methods are ISR-safe — timer reads only, no blocking.

Definition at line 112 of file non_blocking_delay.hpp.

Constructor & Destructor Documentation

◆ IntervalTimer()

template<typename SystemTimeImpl >
sbl::patterns::timing::IntervalTimer< SystemTimeImpl >::IntervalTimer ( uint32_t  interval_ms)
inlineexplicit

Constructor with interval period.

Parameters
interval_msInterval period in milliseconds

Definition at line 118 of file non_blocking_delay.hpp.

Member Function Documentation

◆ getInterval()

template<typename SystemTimeImpl >
uint32_t sbl::patterns::timing::IntervalTimer< SystemTimeImpl >::getInterval ( ) const
inline

Get current interval.

Returns
Current interval in milliseconds

Definition at line 163 of file non_blocking_delay.hpp.

◆ setInterval()

template<typename SystemTimeImpl >
void sbl::patterns::timing::IntervalTimer< SystemTimeImpl >::setInterval ( uint32_t  interval_ms)
inline

Update interval period.

Parameters
interval_msNew interval in milliseconds

Definition at line 155 of file non_blocking_delay.hpp.

◆ start()

template<typename SystemTimeImpl >
void sbl::patterns::timing::IntervalTimer< SystemTimeImpl >::start ( )
inline

Start the interval timer.

Definition at line 124 of file non_blocking_delay.hpp.

◆ stop()

template<typename SystemTimeImpl >
void sbl::patterns::timing::IntervalTimer< SystemTimeImpl >::stop ( )
inline

Stop the interval timer.

Definition at line 147 of file non_blocking_delay.hpp.

◆ tick()

template<typename SystemTimeImpl >
bool sbl::patterns::timing::IntervalTimer< SystemTimeImpl >::tick ( )
inline

Check if interval has elapsed and auto-reset.

Returns
true if interval has elapsed (resets automatically)

Definition at line 133 of file non_blocking_delay.hpp.


The documentation for this class was generated from the following file: