MeshX 0.3
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.
|
Header file for OS timer utilities. More...
#include <stdint.h>
#include "sys/queue.h"
#include "meshx_control_task.h"
#include "interface/rtos/meshx_rtos_timer.h"
Go to the source code of this file.
Data Structures | |
struct | meshx_os_timer |
Structure to hold parameters for the OS timer control task message. More... | |
Macros | |
#define | OS_TIMER_SIZE sizeof(meshx_os_timer_t) |
return meshx_os_timer_t size | |
#define | OS_TMER_GET_TIMER_NAME(timer) |
return timer registered name pointer | |
Typedefs | |
typedef meshx_rtos_timer_t | meshx_os_timer_handle_t |
Alias for the meshx_rtos_timer_t type. | |
typedef struct meshx_os_timer | meshx_os_timer_t |
Alias for the meshx_os_timer structure. | |
typedef void(* | meshx_os_timer_cb_t) (const meshx_os_timer_t *p_timer) |
Timer callback function prototype. | |
Functions | |
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. | |
Header file for OS timer utilities.
Copyright © 2024 - 2025 MeshX
This file contains the definitions and includes necessary for working with OS timers in the ESP32 BLE mesh node application.
Definition in file meshx_os_timer.h.
#define OS_TIMER_SIZE sizeof(meshx_os_timer_t) |
return meshx_os_timer_t size
Definition at line 24 of file meshx_os_timer.h.
#define OS_TMER_GET_TIMER_NAME | ( | timer | ) |
return timer registered name pointer
Definition at line 29 of file meshx_os_timer.h.
typedef void(* meshx_os_timer_cb_t) (const meshx_os_timer_t *p_timer) |
Timer callback function prototype.
This function is called when the timer expires.
[in] | p_timer | The timer handle. |
Definition at line 55 of file meshx_os_timer.h.
Alias for the meshx_rtos_timer_t type.
This typedef provides a more convenient name for the FreeRTOS timer handle type, used for creating and managing timers.
Definition at line 38 of file meshx_os_timer.h.
typedef struct meshx_os_timer meshx_os_timer_t |
Alias for the meshx_os_timer structure.
This typedef provides a more convenient name for the meshx_os_timer structure, which holds the parameters for the OS timer control task message.
Definition at line 47 of file meshx_os_timer.h.
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:
Definition at line 263 of file meshx_os_timer.c.
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. |
Definition at line 418 of file meshx_os_timer.c.
meshx_err_t meshx_os_timer_init | ( | void | ) |
Initialize the OS timer module.
This function initializes the OS timer module.
Definition at line 226 of file meshx_os_timer.c.
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. |
Definition at line 339 of file meshx_os_timer.c.
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 |
Definition at line 365 of file meshx_os_timer.c.
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. |
Definition at line 314 of file meshx_os_timer.c.
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. |
Definition at line 392 of file meshx_os_timer.c.