#include <mn_timer_esp32.hpp>
|
| basic_esp32_timer (const char *strName, unsigned int uiPeriod, bool bIsOneShot=true) |
|
virtual | ~basic_esp32_timer () |
|
virtual int | create () |
|
virtual int | destroy (unsigned int timeout=(unsigned int) 0xffffffffUL) |
|
virtual int | active (unsigned int timeout=(unsigned int) 0xffffffffUL) |
|
virtual int | inactive (unsigned int timeout=(unsigned int) 0xffffffffUL) |
|
virtual int | reset (unsigned int timeout=(unsigned int) 0xffffffffUL) |
|
virtual bool | set_period (unsigned int uiNewPeriod, unsigned int timeout=(unsigned int) 0xffffffffUL) |
|
virtual unsigned int | get_period () |
|
virtual void * | get_handle () |
|
virtual void | set_id (int nId) |
|
virtual bool | is_running () |
|
virtual | operator bool () |
|
Wrapper class around esp-idf of a timer. This is a base abstract class, all esp32_timers must be override the function on_timer()
◆ basic_esp32_timer()
mn::esp32::basic_esp32_timer::basic_esp32_timer |
( |
const char * |
strName, |
|
|
unsigned int |
uiPeriod, |
|
|
bool |
bIsOneShot = true |
|
) |
| |
Construct a timer.
- Parameters
-
strName | Name of the timer. |
uiPeriod | When does the timer expire and run your Run() method. |
bIsOneShot | true if this is a one shot timer. false if the timer expires every PeriodInTicks. |
◆ ~basic_esp32_timer()
virtual mn::esp32::basic_esp32_timer::~basic_esp32_timer |
( |
| ) |
|
|
inlinevirtual |
◆ active()
int mn::esp32::basic_esp32_timer::active |
( |
unsigned int |
timeout = (unsigned int) 0xffffffffUL | ) |
|
|
virtual |
Start the timer.
- Parameters
-
timeout | How long to wait - not use |
- Returns
- ERR_TIMER_OK All okay, no error ERR_TIMER_NOTCREATED the timer are not created, plaese call create() first ERR_TIMER_AKTIVATE if it will not (i.e. timeout).
Implements mn::ITimer.
◆ create()
int mn::esp32::basic_esp32_timer::create |
( |
| ) |
|
|
virtual |
Create the timer
- Note
- Timers are not active after they are created, you need to activate them via active, reset, etc.
- Returns
- - ERR_TIMER_OK No error,
- ERR_TIMER_ALREADYINIT The timer are allready created
- ERR_TIMER_CANTCREATE on error on create the ESP Timer
Implements mn::ITimer.
◆ destroy()
int mn::esp32::basic_esp32_timer::destroy |
( |
unsigned int |
timeout = (unsigned int) 0xffffffffUL | ) |
|
|
virtual |
destroy the timer
- Parameters
-
timeout | How long to wait - not use |
- Returns
- - ERR_TIMER_OK No error,
- ERR_TIMER_NOTCREATED the timer are not created, plaese call create() first
Implements mn::ITimer.
◆ get_handle()
void * mn::esp32::basic_esp32_timer::get_handle |
( |
| ) |
|
|
virtual |
Get the timer handle
- Returns
- The timer handle
Implements mn::ITimer.
◆ get_period()
virtual unsigned int mn::esp32::basic_esp32_timer::get_period |
( |
| ) |
|
|
inlinevirtual |
Get the timer's period
- Returns
- The timer's period
Implements mn::ITimer.
◆ inactive()
int mn::esp32::basic_esp32_timer::inactive |
( |
unsigned int |
timeout = (unsigned int) 0xffffffffUL | ) |
|
|
virtual |
Stop the timer
- Parameters
-
timeout | How long to wait - not use |
- Returns
- ERR_TIMER_OK All okay, no error ERR_TIMER_NOTCREATED the timer are not created, plaese call create() first ERR_TIMER_INAKTIVATE Can not stop the timer
Implements mn::ITimer.
◆ is_running()
virtual bool mn::esp32::basic_esp32_timer::is_running |
( |
| ) |
|
|
inlinevirtual |
Queries a timer to see if it is active or dormant.
- Returns
- false will be returned if the timer is dormant. And true will be returned if the timer is active.
Implements mn::ITimer.
◆ on_enter()
virtual void mn::esp32::basic_esp32_timer::on_enter |
( |
| ) |
|
|
inlineprotectedvirtual |
◆ on_exit()
virtual void mn::esp32::basic_esp32_timer::on_exit |
( |
| ) |
|
|
inlineprotectedvirtual |
◆ on_timer()
virtual void mn::esp32::basic_esp32_timer::on_timer |
( |
| ) |
|
|
protectedpure virtual |
Implementation of your actual timer code. You must override this function.
Implements mn::ITimer.
◆ operator bool()
virtual mn::esp32::basic_esp32_timer::operator bool |
( |
| ) |
|
|
inlinevirtual |
◆ reset()
int mn::esp32::basic_esp32_timer::reset |
( |
unsigned int |
timeout = (unsigned int) 0xffffffffUL | ) |
|
|
virtual |
Reset the timer (first inactive and then active)
- Parameters
-
timeout | How long to wait - not use |
- Returns
- - ERR_TIMER_OK All okay, no error
- ERR_TIMER_NOTCREATED the timer are not created, plaese call create() first
- ERR_TIMER_RESET Can not reset
- ERR_TIMER_INAKTIVATE Can not stop the timer
Implements mn::ITimer.
◆ runtimerstub()
void mn::esp32::basic_esp32_timer::runtimerstub |
( |
void * |
xTimer | ) |
|
|
staticprivate |
Adapter function that allows you to write a class specific on_timer() function that interfaces with FreeRTOS.
◆ set_id()
virtual void mn::esp32::basic_esp32_timer::set_id |
( |
int |
nId | ) |
|
|
inlinevirtual |
Get the timer ID - not implantated
Implements mn::ITimer.
◆ set_period()
bool mn::esp32::basic_esp32_timer::set_period |
( |
unsigned int |
uiNewPeriod, |
|
|
unsigned int |
timeout = (unsigned int) 0xffffffffUL |
|
) |
| |
|
virtual |
Change a timer's period.
- Parameters
-
uiNewPeriod | The new period in ticks. |
timeout | How long to wait |
- Returns
- true no error, false if it will not (i.e. timeout).
Implements mn::ITimer.
◆ m_bIsInit
bool mn::esp32::basic_esp32_timer::m_bIsInit |
|
private |
A saved / cached copy is the timer created
◆ m_bIsOneShot
bool mn::esp32::basic_esp32_timer::m_bIsOneShot |
|
private |
A saved / cached copy of what the timers's mode is.
◆ m_bIsRunning
bool mn::esp32::basic_esp32_timer::m_bIsRunning |
|
private |
A saved / cached copy is the timer running
◆ m_pHandle
esp_timer_handle_t mn::esp32::basic_esp32_timer::m_pHandle |
|
private |
Reference to the underlying timer handle.
◆ m_strName
const char* mn::esp32::basic_esp32_timer::m_strName |
|
private |
A saved / cached copy of what the timers's name is.
◆ m_uiPeriod
unsigned int mn::esp32::basic_esp32_timer::m_uiPeriod |
|
private |
A saved / cached copy of what the timers's period is.
The documentation for this class was generated from the following files: