M5Unified
M5Timer Class Reference

#include <M5Timer.h>

Public Member Functions

 M5Timer (void)
 constructor More...
 
void run (void)
 this function must be called inside loop() More...
 
int_fast8_t setTimer (uint32_t interval_msec, timer_callback function, uint32_t times)
 
int_fast8_t setInterval (uint32_t interval_msec, timer_callback function)
 
int_fast8_t setTimeout (uint32_t interval_msec, timer_callback function)
 
void deleteTimer (int_fast8_t id)
 
void restartTimer (int_fast8_t id)
 
void enable (int_fast8_t id)
 
void disable (int_fast8_t id)
 
void toggle (int_fast8_t id)
 
bool isEnabled (int_fast8_t id) const
 
uint_fast8_t getNumTimers (void) const
 
uint_fast8_t getNumAvailableTimers (void) const
 

Static Public Attributes

static constexpr const uint32_t MAX_TIMERS = 10
 maximum number of timers More...
 

Detailed Description

Definition at line 13 of file M5Timer.h.

Constructor & Destructor Documentation

◆ M5Timer()

M5Timer::M5Timer ( void  )

constructor

Definition at line 7 of file M5Timer.cpp.

Member Function Documentation

◆ deleteTimer()

void M5Timer::deleteTimer ( int_fast8_t  id)

Destroy the specified timer.

Parameters
idtarget timer id.

Definition at line 69 of file M5Timer.cpp.

◆ disable()

void M5Timer::disable ( int_fast8_t  id)
inline

Disables the specified timer.

Parameters
idtarget timer id.

Definition at line 64 of file M5Timer.h.

◆ enable()

void M5Timer::enable ( int_fast8_t  id)
inline

Enables the specified timer.

Parameters
idtarget timer id.

Definition at line 56 of file M5Timer.h.

◆ getNumAvailableTimers()

uint_fast8_t M5Timer::getNumAvailableTimers ( void  ) const
inline

gets the number of available timers.

Returns
number of available timers.

Definition at line 93 of file M5Timer.h.

◆ getNumTimers()

uint_fast8_t M5Timer::getNumTimers ( void  ) const
inline

gets the number of used timers.

Returns
number of used timers.

Definition at line 87 of file M5Timer.h.

◆ isEnabled()

bool M5Timer::isEnabled ( int_fast8_t  id) const
inline

gets true if the specified timer is enabled

Parameters
idtarget timer id.
Returns
false=disabled / true=enabled.

Definition at line 81 of file M5Timer.h.

◆ restartTimer()

void M5Timer::restartTimer ( int_fast8_t  id)

Restart the specified timer.

Parameters
idtarget timer id.

Definition at line 76 of file M5Timer.cpp.

◆ run()

void M5Timer::run ( void  )

this function must be called inside loop()

Definition at line 44 of file M5Timer.cpp.

◆ setInterval()

int_fast8_t M5Timer::setInterval ( uint32_t  interval_msec,
timer_callback  function 
)
inline

Call function every interval [msec].

Parameters
interval_msecinterval [msec]
functiontarget function.
Returns
-1 = failed / 0 or more = target timer id.

Definition at line 34 of file M5Timer.h.

Here is the call graph for this function:

◆ setTimeout()

int_fast8_t M5Timer::setTimeout ( uint32_t  interval_msec,
timer_callback  function 
)
inline

Call function once after interval [msec].

Parameters
interval_msecinterval [msec]
functiontarget function.
Returns
-1 = failed / 0 or more = target timer id.

Definition at line 42 of file M5Timer.h.

Here is the call graph for this function:

◆ setTimer()

int_fast8_t M5Timer::setTimer ( uint32_t  interval_msec,
timer_callback  function,
uint32_t  times 
)

Call function every interval [msec] for specified times.

Parameters
interval_msecinterval [msec]
functiontarget function.
Returns
-1 = failed / 0 or more = target timer id.

Definition at line 56 of file M5Timer.cpp.

Here is the caller graph for this function:

◆ toggle()

void M5Timer::toggle ( int_fast8_t  id)
inline

Enables the specified timer if it is currently disabled, and vice versa.

Parameters
idtarget timer id.

Definition at line 72 of file M5Timer.h.

Member Data Documentation

◆ MAX_TIMERS

constexpr const uint32_t M5Timer::MAX_TIMERS = 10
staticconstexpr

maximum number of timers

Definition at line 16 of file M5Timer.h.


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