Software timer APIs.
More...
#include "list.h"
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
|
| typedef struct timer_pool | timer_pool_t |
| | Internal timer pool type.
|
| typedef uint8_t | timer_id_t |
| | Timer identifier type.
|
| typedef void(* | timer_cb) () |
| | Timer callback signature.
|
Software timer APIs.
- Author
- Snoopy3921 - AK Foundation
- Date
- 2026/05/08
Definition in file timer.h.
◆ timer_cb
| typedef void(* timer_cb) () |
Timer callback signature.
Callback runs in timer-thread context; keep execution short and non-blocking.
Definition at line 37 of file timer.h.
◆ timer_id_t
Timer identifier type.
Definition at line 29 of file timer.h.
◆ timer_pool_t
Internal timer pool type.
Definition at line 27 of file timer.h.
◆ timer_type_t
Timer mode.
| Enumerator |
|---|
| TIMER_ONE_SHOT | Expires once and then stops.
|
| TIMER_PERIODIC | Reloads using timer.period.
|
Definition at line 43 of file timer.h.
◆ akos_timer_create()
Create a timer object from timer pool.
@brief Create timer object from timer pool.
@param id Timer ID.
@param sig Signal posted when timer expires.
@param func_cb Optional callback executed on expiry.
- Parameters
-
| des_thread_id | Destination thread ID for signal posting. |
| period | Period in ticks for periodic timers. |
| type | Timer type (one-shot or periodic). |
- Returns
- Created timer pointer, or NULL on failure.
- Parameters
-
| id | Timer ID. |
| sig | Signal posted on timeout. |
| func_cb | Optional callback run on timeout. |
| des_thread_id | Destination thread ID for signal posting. |
| period | Period in ticks for periodic timer. |
| type | Timer type. |
- Returns
- Timer pointer, or NULL on failure.
Definition at line 146 of file timer.c.
◆ akos_timer_init()
| void akos_timer_init |
( |
void | | ) |
|
Initialize timer module.
Initialize timer module.
Definition at line 234 of file timer.c.
◆ akos_timer_processing()
| void akos_timer_processing |
( |
| ) |
|
Timer thread processing loop.
Timer thread processing loop.
Processes expired timers, executes callbacks/posts signals, then blocks until the next timer event (or a wakeup message).
Definition at line 247 of file timer.c.
◆ akos_timer_remove()
| void akos_timer_remove |
( |
ak_timer_t * | p_timer | ) |
|
Remove timer from active lists and return to pool.
- Parameters
-
Remove timer from active lists and return to pool.
- Parameters
-
Definition at line 211 of file timer.c.
◆ akos_timer_reset()
| void akos_timer_reset |
( |
ak_timer_t * | p_timer | ) |
|
Reset a running timer.
- Parameters
-
Reset a running timer.
- Parameters
-
Definition at line 321 of file timer.c.
◆ akos_timer_start()
| void akos_timer_start |
( |
ak_timer_t * | p_timer, |
|
|
uint32_t | tick_to_wait ) |
Start a timer.
- Parameters
-
| p_timer | Timer pointer. |
| tick_to_wait | Initial delay in ticks. |
Start a timer.
- Parameters
-
| p_timer | Timer object. |
| tick_to_wait | Initial delay in ticks. |
Definition at line 306 of file timer.c.