Loading...
Searching...
No Matches
timer.h File Reference

Furi software Timer API. More...

#include "base.h"

Go to the source code of this file.

Typedefs

typedef void(* FuriTimerCallback) (void *context)
 
typedef struct FuriTimer FuriTimer
 
typedef void(* FuriTimerPendigCallback) (void *context, uint32_t arg)
 

Enumerations

enum  FuriTimerType { FuriTimerTypeOnce = 0 , FuriTimerTypePeriodic = 1 }
 
enum  FuriTimerThreadPriority { FuriTimerThreadPriorityNormal , FuriTimerThreadPriorityElevated }
 

Functions

FuriTimerfuri_timer_alloc (FuriTimerCallback func, FuriTimerType type, void *context)
 Allocate timer.
 
void furi_timer_free (FuriTimer *instance)
 Free timer.
 
void furi_timer_flush (void)
 Flush timer task control message queue.
 
FuriStatus furi_timer_start (FuriTimer *instance, uint32_t ticks)
 Start timer.
 
FuriStatus furi_timer_restart (FuriTimer *instance, uint32_t ticks)
 Restart timer with previous timeout value.
 
FuriStatus furi_timer_stop (FuriTimer *instance)
 Stop timer.
 
uint32_t furi_timer_is_running (FuriTimer *instance)
 Is timer running.
 
uint32_t furi_timer_get_expire_time (FuriTimer *instance)
 Get timer expire time.
 
void furi_timer_pending_callback (FuriTimerPendigCallback callback, void *context, uint32_t arg)
 
void furi_timer_set_thread_priority (FuriTimerThreadPriority priority)
 Set Timer thread priority.
 

Detailed Description

Furi software Timer API.

Enumeration Type Documentation

◆ FuriTimerThreadPriority

Enumerator
FuriTimerThreadPriorityNormal 

Lower then other threads.

FuriTimerThreadPriorityElevated 

Same as other threads.

◆ FuriTimerType

Enumerator
FuriTimerTypeOnce 

One-shot timer.

FuriTimerTypePeriodic 

Repeating timer.

Function Documentation

◆ furi_timer_alloc()

FuriTimer * furi_timer_alloc ( FuriTimerCallback func,
FuriTimerType type,
void * context )

Allocate timer.

Parameters
[in]funcThe callback function
[in]typeThe timer type
contextThe callback context
Returns
The pointer to FuriTimer instance

◆ furi_timer_flush()

void furi_timer_flush ( void )

Flush timer task control message queue.

Ensures that all commands before this point was processed.

◆ furi_timer_free()

void furi_timer_free ( FuriTimer * instance)

Free timer.

Parameters
instanceThe pointer to FuriTimer instance

◆ furi_timer_get_expire_time()

uint32_t furi_timer_get_expire_time ( FuriTimer * instance)

Get timer expire time.

Parameters
instanceThe Timer instance
Returns
expire tick

◆ furi_timer_is_running()

uint32_t furi_timer_is_running ( FuriTimer * instance)

Is timer running.

Warning
This cal may and will return obsolete timer state if timer commands are still in the queue. Please read FreeRTOS timer documentation first.
Parameters
instanceThe pointer to FuriTimer instance
Returns
0: not running, 1: running

◆ furi_timer_restart()

FuriStatus furi_timer_restart ( FuriTimer * instance,
uint32_t ticks )

Restart timer with previous timeout value.

Warning
This is asynchronous call, real operation will happen as soon as timer service process this request.
Parameters
instanceThe pointer to FuriTimer instance
[in]ticksThe interval in ticks
Returns
The furi status.

◆ furi_timer_set_thread_priority()

void furi_timer_set_thread_priority ( FuriTimerThreadPriority priority)

Set Timer thread priority.

Parameters
[in]priorityThe priority

◆ furi_timer_start()

FuriStatus furi_timer_start ( FuriTimer * instance,
uint32_t ticks )

Start timer.

Warning
This is asynchronous call, real operation will happen as soon as timer service process this request.
Parameters
instanceThe pointer to FuriTimer instance
[in]ticksThe interval in ticks
Returns
The furi status.

◆ furi_timer_stop()

FuriStatus furi_timer_stop ( FuriTimer * instance)

Stop timer.

Warning
This is synchronous call that will be blocked till timer queue processed.
Parameters
instanceThe pointer to FuriTimer instance
Returns
The furi status.