|
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.
|
Utility functions for RTOS operations in the MeshX framework. More...


Go to the source code of this file.
Functions | |
| meshx_err_t | meshx_rtos_get_sys_time (unsigned int *millis) |
| Retrieves the current system time in milliseconds. | |
| meshx_err_t | meshx_rtos_malloc (void **ptr, size_t size) |
| Allocates memory dynamically in a thread-safe manner using FreeRTOS. | |
| meshx_err_t | meshx_rtos_calloc (void **ptr, size_t num, size_t size) |
| Allocates memory for an array of elements and initializes it to zero. | |
| meshx_err_t | meshx_rtos_free (void **ptr) |
| Frees memory allocated to a pointer and sets it to NULL. | |
| size_t | meshx_rtos_get_free_heap (void) |
| Retrieves the amount of free heap memory available in the system. | |
| meshx_err_t | meshx_rtos_get_curr_task_id_prio (unsigned int *task_id) |
| Retrieves the current task ID. | |
Utility functions for RTOS operations in the MeshX framework.
This header file provides a set of utility functions for interacting with the RTOS in the MeshX framework. These utilities include functions for retrieving system time, memory allocation and deallocation, and querying the amount of free heap memory.
The functions in this file are designed to simplify common RTOS operations and ensure consistent error handling across the MeshX framework.
Definition in file meshx_rtos_utils.h.
| meshx_err_t meshx_rtos_calloc | ( | void ** | ptr, |
| size_t | num, | ||
| size_t | size ) |
Allocates memory for an array of elements and initializes it to zero.
This function allocates memory for an array of num elements, each of size size, and initializes all bytes in the allocated memory to zero. The allocated memory pointer is returned via the ptr parameter.
| [out] | ptr | Pointer to the allocated memory. This will be set to NULL if the allocation fails. |
| [in] | num | Number of elements to allocate. |
| [in] | size | Size of each element in bytes. |
Definition at line 96 of file meshx_utils.c.
| meshx_err_t meshx_rtos_free | ( | void ** | ptr | ) |
Frees memory allocated to a pointer and sets it to NULL.
This function is used to safely deallocate memory that was previously allocated and ensures that the pointer is set to NULL to avoid dangling pointer issues.
| [in,out] | ptr | A double pointer to the memory to be freed. After the memory is freed, the pointer is set to NULL. |
Definition at line 129 of file meshx_utils.c.


| meshx_err_t meshx_rtos_get_curr_task_id_prio | ( | unsigned int * | task_id | ) |
Retrieves the current task ID.
This function retrieves the current task ID using FreeRTOS APIs. The task ID is stored in the variable pointed to by the task_id parameter.
| [out] | task_id | Pointer to an unsigned integer where the task ID will be stored. |
task_id pointer is valid and not NULL before calling this function. Definition at line 170 of file meshx_utils.c.

| size_t meshx_rtos_get_free_heap | ( | void | ) |
Retrieves the amount of free heap memory available in the system.
This function is used to query the current amount of free heap memory available in the system. It is useful for monitoring memory usage and ensuring that the system has sufficient resources for dynamic memory allocation.
Definition at line 150 of file meshx_utils.c.

| meshx_err_t meshx_rtos_get_sys_time | ( | unsigned int * | millis | ) |
Retrieves the current system time in milliseconds.
This function calculates the system time in milliseconds based on the FreeRTOS tick count and the configured tick rate. The result is stored in the variable pointed to by the millis parameter.
| [out] | millis | Pointer to an unsigned integer where the system time in milliseconds will be stored. |
millis pointer is valid and not NULL before calling this function. Definition at line 36 of file meshx_utils.c.

| meshx_err_t meshx_rtos_malloc | ( | void ** | ptr, |
| size_t | size ) |
Allocates memory dynamically in a thread-safe manner using FreeRTOS.
This function wraps the memory allocation process to ensure compatibility with the FreeRTOS environment. It allocates a block of memory of the specified size and assigns the pointer to the provided pointer variable.
| [out] | ptr | Pointer to the memory location where the allocated memory address will be stored. Must not be NULL. |
| [in] | size | The size of the memory block to allocate, in bytes. |
Definition at line 65 of file meshx_utils.c.
