arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
AudioTimerDriverZephyr Class Reference

Repeating Timer driver for Zephyr using k_timer. More...

#include <AudioTimerZephyr.h>

Inheritance diagram for AudioTimerDriverZephyr:
AudioTimerDriverBase

Public Member Functions

 AudioTimerDriverZephyr ()=default
 
 ~AudioTimerDriverZephyr ()
 
bool begin (repeating_timer_callback_t callback_f, uint32_t time, TimeUnit unit=MS) override
 Starts the repeating timer.
 
voidcallbackParameter ()
 
bool end () override
 Stops the timer.
 
void setCallbackParameter (void *obj)
 
void setIsSave (bool is_save) override
 Sets whether timer callbacks should be safe (execute in thread context)
 
virtual void setTimer (int timer)
 
void setTimerFunction (TimerFunction function) override
 Sets the callback execution mode.
 

Protected Member Functions

void executeCallback ()
 
const chartoString (TimeUnit unit)
 

Static Protected Member Functions

static void timerExpiredCallback (struct k_timer *timer_ptr)
 
static void workCallback (k_work *work_ptr)
 

Protected Attributes

repeating_timer_callback_t callback = nullptr
 
bool is_running = false
 
voidobject = nullptr
 
uint64_t period_us = 0
 
struct k_timer timer = {}
 
TimerFunction timer_function = DirectTimerCallback
 
bool timer_initialized = false
 
struct k_work work = {}
 

Detailed Description

Repeating Timer driver for Zephyr using k_timer.

Author
Phil Schatzmann

Implements AudioTimerDriverBase using Zephyr's kernel timer API (k_timer). Supports both callback-based and thread-based execution modes.

Characteristics:

Constructor & Destructor Documentation

◆ AudioTimerDriverZephyr()

◆ ~AudioTimerDriverZephyr()

Member Function Documentation

◆ begin()

bool begin ( repeating_timer_callback_t  callback_f,
uint32_t  time,
TimeUnit  unit = MS 
)
inlineoverridevirtual

Starts the repeating timer.

Implements AudioTimerDriverBase.

◆ callbackParameter()

void * callbackParameter ( )
inlineinherited

◆ end()

bool end ( )
inlineoverridevirtual

Stops the timer.

Reimplemented from AudioTimerDriverBase.

◆ executeCallback()

void executeCallback ( )
inlineprotected

◆ setCallbackParameter()

void setCallbackParameter ( void obj)
inlineinherited

◆ setIsSave()

void setIsSave ( bool  is_save)
inlineoverridevirtual

Sets whether timer callbacks should be safe (execute in thread context)

Reimplemented from AudioTimerDriverBase.

◆ setTimer()

virtual void setTimer ( int  timer)
inlinevirtualinherited

◆ setTimerFunction()

void setTimerFunction ( TimerFunction  function)
inlineoverridevirtual

Sets the callback execution mode.

Reimplemented from AudioTimerDriverBase.

◆ timerExpiredCallback()

static void timerExpiredCallback ( struct k_timer timer_ptr)
inlinestaticprotected

Static callback wrapper for k_timer This is invoked in interrupt context, so we either call directly or defer to system workqueue.

◆ toString()

const char * toString ( TimeUnit  unit)
inlineprotectedinherited

◆ workCallback()

static void workCallback ( k_work work_ptr)
inlinestaticprotected

Member Data Documentation

◆ callback

repeating_timer_callback_t callback = nullptr
protected

◆ is_running

bool is_running = false
protected

◆ object

void* object = nullptr
protectedinherited

◆ period_us

uint64_t period_us = 0
protected

◆ timer

struct k_timer timer = {}
protected

◆ timer_function

TimerFunction timer_function = DirectTimerCallback
protected

◆ timer_initialized

bool timer_initialized = false
protected

◆ work

struct k_work work = {}
protected

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