C++ refactoring (#91)
This commit is contained in:
committed by
GitHub
parent
d06137ba76
commit
ca5d4b8226
@@ -2,62 +2,35 @@
|
||||
|
||||
#include "CoreTypes.h"
|
||||
|
||||
#ifdef ESP_TARGET
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/event_groups.h"
|
||||
#else
|
||||
#include "FreeRTOS.h"
|
||||
#include "event_groups.h"
|
||||
#endif
|
||||
|
||||
namespace tt {
|
||||
|
||||
typedef void EventFlag;
|
||||
#define TT_API_LOCK_EVENT (1U << 0)
|
||||
|
||||
/** Allocate EventFlag
|
||||
*
|
||||
* @return pointer to EventFlag
|
||||
/**
|
||||
* Wrapper for FreeRTOS xEventGroup.
|
||||
*/
|
||||
EventFlag* event_flag_alloc();
|
||||
|
||||
/** Deallocate EventFlag
|
||||
*
|
||||
* @param instance pointer to EventFlag
|
||||
*/
|
||||
void event_flag_free(EventFlag* instance);
|
||||
|
||||
/** Set flags
|
||||
*
|
||||
* @param instance pointer to EventFlag
|
||||
* @param[in] flags The flags
|
||||
*
|
||||
* @return Resulting flags or error (TtStatus)
|
||||
*/
|
||||
uint32_t event_flag_set(EventFlag* instance, uint32_t flags);
|
||||
|
||||
/** Clear flags
|
||||
*
|
||||
* @param instance pointer to EventFlag
|
||||
* @param[in] flags The flags
|
||||
*
|
||||
* @return Resulting flags or error (TtStatus)
|
||||
*/
|
||||
uint32_t event_flag_clear(EventFlag* instance, uint32_t flags);
|
||||
|
||||
/** Get flags
|
||||
*
|
||||
* @param instance pointer to EventFlag
|
||||
*
|
||||
* @return Resulting flags
|
||||
*/
|
||||
uint32_t event_flag_get(EventFlag* instance);
|
||||
|
||||
/** Wait flags
|
||||
*
|
||||
* @param instance pointer to EventFlag
|
||||
* @param[in] flags The flags
|
||||
* @param[in] options The option flags
|
||||
* @param[in] timeout The timeout
|
||||
*
|
||||
* @return Resulting flags or error (TtStatus)
|
||||
*/
|
||||
uint32_t event_flag_wait(
|
||||
EventFlag* instance,
|
||||
uint32_t flags,
|
||||
uint32_t options,
|
||||
uint32_t timeout
|
||||
);
|
||||
class EventFlag {
|
||||
private:
|
||||
EventGroupHandle_t handle;
|
||||
public:
|
||||
EventFlag();
|
||||
~EventFlag();
|
||||
uint32_t set(uint32_t flags) const;
|
||||
uint32_t clear(uint32_t flags) const;
|
||||
uint32_t get() const;
|
||||
uint32_t wait(
|
||||
uint32_t flags,
|
||||
uint32_t options = TtFlagWaitAny,
|
||||
uint32_t timeout = TtWaitForever
|
||||
) const;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user