mn_eventgroup.hpp
Go to the documentation of this file.
1 
19 #ifndef MINLIB_ESP32_EVENT_GROUP_
20 #define MINLIB_ESP32_EVENT_GROUP_
21 
22 #include "mn_config.hpp"
23 
24 
25 #include <freertos/FreeRTOS.h>
26 #include <freertos/event_groups.h>
27 
28 #include "mn_copyable.hpp"
29 
30 namespace mn {
36  public:
52  basic_event_group(const char* strName = "unamed");
56  basic_event_group(EventGroupHandle_t handle);
57 
63  virtual ~basic_event_group();
64 
71  int create();
72 
96  EventBits_t sync( const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor,
97  TickType_t xTicksToWait);
98 
113  bool is_bit( const EventBits_t uxBitToWaitFor, uint32_t timeout);
114 
167  EventBits_t wait( const EventBits_t uxBitsToWaitFor,
168  bool xClearOnExit, bool xWaitForAllBits, uint32_t timeout);
169 
179  EventBits_t clear(const EventBits_t uxBitsToClear);
180 
188  EventBits_t get();
189 
199  EventBits_t set(const EventBits_t uxBitsToSet);
200 
205  EventGroupHandle_t get_handle() { return m_pHandle; }
206 
211  bool is_init() { return m_pHandle != NULL; }
212 
217  const char* get_name() { return m_strName; }
218 
223  void set_name(const char* strName);
224  private:
228  void init_internal();
229  private:
233  EventGroupHandle_t m_pHandle;
237  char m_strName[16];
238 
239  #if( configSUPPORT_STATIC_ALLOCATION == 1 )
243  StaticEventGroup_t m_xEventGroupBuffer;
244  #endif
245  };
246 
248 }
249 #endif
Wrapper class around FreeRTOS's implementation of a event_group.
Definition: mn_eventgroup.hpp:35
void set_name(const char *strName)
Set a new debug name for this event group.
Definition: mn_eventgroup.cpp:193
EventBits_t get()
Returns the current value of the event bits (event flags) in an event group.
Definition: mn_eventgroup.cpp:127
bool is_bit(const EventBits_t uxBitToWaitFor, uint32_t timeout)
Block to wait for one bit to be set within a previously created event group.
Definition: mn_eventgroup.cpp:77
EventBits_t wait(const EventBits_t uxBitsToWaitFor, bool xClearOnExit, bool xWaitForAllBits, uint32_t timeout)
Block to wait for one or more bits to be set within a previously created event group.
Definition: mn_eventgroup.cpp:88
EventBits_t set(const EventBits_t uxBitsToSet)
Set bits (flags) within an event group.
Definition: mn_eventgroup.cpp:143
void init_internal()
Initialisert the eventgroup.
Definition: mn_eventgroup.cpp:165
basic_event_group(const char *strName="unamed")
Consruct a new event group.
Definition: mn_eventgroup.cpp:36
virtual ~basic_event_group()
Delete an event group.
Definition: mn_eventgroup.cpp:54
EventGroupHandle_t get_handle()
Get the FreeRTOS Event Group handle.
Definition: mn_eventgroup.hpp:205
EventBits_t clear(const EventBits_t uxBitsToClear)
Clear bits (flags) within an event group.
Definition: mn_eventgroup.cpp:111
const char * get_name()
Get the debug name.
Definition: mn_eventgroup.hpp:217
bool is_init()
Is the basic_event_group initilisiert?
Definition: mn_eventgroup.hpp:211
int create()
Create the event group.
Definition: mn_eventgroup.cpp:183
char m_strName[16]
Definition: mn_eventgroup.hpp:237
EventBits_t sync(const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait)
Allow two or more tasks to use an event group to sync each other.
Definition: mn_eventgroup.cpp:63
EventGroupHandle_t m_pHandle
Definition: mn_eventgroup.hpp:233
#define MN_ONCOPYABLE_CLASS
Definition: mn_copyable.hpp:25
Definition: mn_allocator_typetraits.hpp:25