Select one of the symbols to view example projects that use it.
 
Outline
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/event_groups.h"
#include "freertos/idf_additions.h"
#include "esp_heap_caps.h"
------------------------------ Event Groups
xEventGroupCreateWithCaps(UBaseType_t)
vEventGroupDeleteWithCaps(EventGroupHandle_t)
Files
loading...
SourceVuESP-IDF Framework and ExamplesFreeRTOSesp_additions/idf_additions_event_groups.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ /* * This file contains the implementation for some the functions in * idf_additions.h * * event group functions are split into a separate file due to the dependency chain * xEventGroupCreateWithCaps->xEventGroupCreateStatic->event_groups.c->xTimerPendFunctionCallFromISR->timers.c * * In some cases this results in the weak timer task function getting overridden and * used even if the event group functions were discarded due to not being used. * * Putting the event groups function in a separate file avoids this issue unless the users himself calls * event group functions *//* ... */ #include "sdkconfig.h" #include "freertos/FreeRTOS.h" #include "freertos/event_groups.h" #include "freertos/idf_additions.h" #include "esp_heap_caps.h"5 includes /* ------------------------------ Event Groups ------------------------------ */ #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) EventGroupHandle_t xEventGroupCreateWithCaps( UBaseType_t uxMemoryCaps ) { EventGroupHandle_t xEventGroup; StaticEventGroup_t * pxEventGroupBuffer; /* Allocate memory for the event group using the provided memory caps */ pxEventGroupBuffer = heap_caps_malloc( sizeof( StaticEventGroup_t ), uxMemoryCaps ); if( pxEventGroupBuffer == NULL ) { return NULL; }{...} /* Create the event group using static creation API */ xEventGroup = xEventGroupCreateStatic( pxEventGroupBuffer ); if( xEventGroup == NULL ) { heap_caps_free( pxEventGroupBuffer ); }{...} return xEventGroup; }{ ... } /* ... */#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */ /*----------------------------------------------------------*/ #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) void vEventGroupDeleteWithCaps( EventGroupHandle_t xEventGroup ) { // Return value unused if asserts are disabled BaseType_t __attribute__((unused)) xResult; StaticEventGroup_t * pxEventGroupBuffer; /* Retrieve the buffer used to create the event group before deleting it * *//* ... */ xResult = xEventGroupGetStaticBuffer( xEventGroup, &pxEventGroupBuffer ); configASSERT( xResult == pdTRUE ); /* Delete the event group */ vEventGroupDelete( xEventGroup ); /* Free the memory buffer */ heap_caps_free( pxEventGroupBuffer ); }{ ... } /* ... */#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */------------------------------ Event Groups /*----------------------------------------------------------*/
Details