|
MeshX 0.4
This repository provides an implementation for Bluetooth Low Energy (BLE) Mesh network nodes. The project allows you to create BLE mesh nodes that can communicate with each other, enabling the development of smart home solutions or other IoT-based applications.
|
Implementation of OS timer functionalities for BLE mesh node. More...
Macros | |
| #define | OS_TIMER_INIT_MAGIC 0x3892 |
| #define | OS_TIMER_CONTROL_TASK_EVT_MASK |
| Mask for OS timer control task events. | |
Enumerations | |
| enum | meshx_os_timer_cli_cmd_t { OS_TIMER_CLI_CMD_CREATE , OS_TIMER_CLI_CMD_ARM , OS_TIMER_CLI_CMD_REARM , OS_TIMER_CLI_CMD_DISARM , OS_TIMER_CLI_CMD_DELETE , OS_TIMER_CLI_CMD_PERIOD_SET , OS_TIMER_CLI_CMD_MAX } |
| OS Timer CLI command enumeration. More... | |
Functions | |
| SLIST_HEAD (meshx_os_timer_reg_head, meshx_os_timer) | |
| static void | meshx_os_timer_ut_cb_handler (const meshx_os_timer_t *p_timer) |
| OS Timer Unit Test Callback handler. | |
| static meshx_err_t | meshx_os_timer_unit_test_cb_handler (int cmd_id, int argc, char **argv) |
| Callback handler for OS Timer unit test command. | |
| void | meshx_os_timer_fire_cb (const void *timer_handle) |
| static meshx_err_t | meshx_os_timer_control_task_cb (const dev_struct_t *pdev, control_task_msg_evt_t evt, void *params) |
| meshx_err_t | meshx_os_timer_init (void) |
| Initialize the OS timer module. | |
| meshx_err_t | meshx_os_timer_create (const char *name, uint32_t period, bool reload, meshx_os_timer_cb_t cb, meshx_os_timer_t **timer_handle) |
| Create a timer. | |
| meshx_err_t | meshx_os_timer_start (const meshx_os_timer_t *timer_handle) |
| Start a timer. | |
| meshx_err_t | meshx_os_timer_restart (const meshx_os_timer_t *timer_handle) |
| Restart a timer. | |
| meshx_err_t | meshx_os_timer_set_period (meshx_os_timer_t *timer_handle, const uint32_t period_ms) |
| Set period on an initialised timer. | |
| meshx_err_t | meshx_os_timer_stop (const meshx_os_timer_t *timer_handle) |
| Stop a timer. | |
| meshx_err_t | meshx_os_timer_delete (meshx_os_timer_t **timer_handle) |
| Delete a timer. | |
Variables | |
| static struct meshx_os_timer_reg_head | meshx_os_timer_reg_table_head = SLIST_HEAD_INITIALIZER(os_timer_reg_table_head) |
| Head of the OS timer registration table. | |
Implementation of OS timer functionalities for BLE mesh node.
Copyright © 2024 - 2025 MeshX
This file contains the implementation of the OS timer functionalities used in the BLE mesh node application. It includes the necessary includes, definitions, and initialization of the timer registration table.
| #define OS_TIMER_CONTROL_TASK_EVT_MASK |
Mask for OS timer control task events.
This mask includes the following events:
| #define OS_TIMER_INIT_MAGIC 0x3892 |
OS Timer CLI command enumeration.
| Enumerator | |
|---|---|
| OS_TIMER_CLI_CMD_CREATE | |
| OS_TIMER_CLI_CMD_ARM | |
| OS_TIMER_CLI_CMD_REARM | |
| OS_TIMER_CLI_CMD_DISARM | |
| OS_TIMER_CLI_CMD_DELETE | |
| OS_TIMER_CLI_CMD_PERIOD_SET | |
| OS_TIMER_CLI_CMD_MAX | |
|
static |
| meshx_err_t meshx_os_timer_create | ( | const char * | name, |
| uint32_t | period, | ||
| bool | reload, | ||
| meshx_os_timer_cb_t | cb, | ||
| meshx_os_timer_t ** | timer_handle ) |
Create a timer.
This function creates a timer with the given period and callback function.
| [in] | name | The name of the timer. |
| [in] | period | The period of the timer in milliseconds. |
| [in] | reload | If true, the timer will automatically reload after expiring. |
| [in] | cb | The callback function to be called when the timer expires. |
| [in,out] | timer_handle | The timer handle. |
Example:
| meshx_err_t meshx_os_timer_delete | ( | meshx_os_timer_t ** | timer_handle | ) |
Delete a timer.
This function deletes the given timer.
| timer_handle | The timer handle. |
| void meshx_os_timer_fire_cb | ( | const void * | timer_handle | ) |
| meshx_err_t meshx_os_timer_init | ( | void | ) |
Initialize the OS timer module.
This function initializes the OS timer module.
| meshx_err_t meshx_os_timer_restart | ( | const meshx_os_timer_t * | timer_handle | ) |
Restart a timer.
This function re-starts the given timer.
| timer_handle | The timer handle. |
| meshx_err_t meshx_os_timer_set_period | ( | meshx_os_timer_t * | timer_handle, |
| const uint32_t | period_ms ) |
Set period on an initialised timer.
This function reset period of initialised timer.
| timer_handle | The timer handle. |
| period_ms | New period in ms |
| meshx_err_t meshx_os_timer_start | ( | const meshx_os_timer_t * | timer_handle | ) |
Start a timer.
This function starts the given timer.
| timer_handle | The timer handle. |
| meshx_err_t meshx_os_timer_stop | ( | const meshx_os_timer_t * | timer_handle | ) |
Stop a timer.
This function stops the given timer.
| timer_handle | The timer handle. |
|
static |
Callback handler for OS Timer unit test command.
This function handles OS Timer unit test command by processing the provided command ID and arguments.
| [in] | cmd_id | The command ID to be processed. |
| [in] | argc | The number of arguments provided. |
| [in] | argv | The array of arguments. |
|
static |
OS Timer Unit Test Callback handler.
| [in] | p_timer | Callback params |
| SLIST_HEAD | ( | meshx_os_timer_reg_head | , |
| meshx_os_timer | ) |
|
static |
Head of the OS timer registration table.
This is initialized using the SLIST_HEAD_INITIALIZER macro.