Ken Van Hoeylandt 3ea02d912f
Merge develop into main (#167)
- WiFi Connect app is now hidden by default, but accessible at the bottom of the WiFi Manage app when WiFi is turned on.
- WiFi service now turns on WiFi when calling connect() and WiFi is not on.
- Removed `blocking` option for `service::loader::startApp()`. This feature was unused and complex.
- Various apps: Moved private headers into Private/ folder.
- Various apps: created start() function for easy starting.
- Added documentation to all TactilityC APIs
- Refactored various `enum` into `class enum`
- Refactor M5Stack `initBoot()` (but VBus is still 0V for some reason)
2025-01-17 19:37:42 +01:00

45 lines
960 B
C++

#pragma once
#include "CoreTypes.h"
#include "Thread.h"
#ifdef ESP_PLATFORM
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#else
#include "FreeRTOS.h"
#include "semphr.h"
#endif
namespace tt {
/**
* Wrapper for xSemaphoreCreateBinary (max count == 1) and xSemaphoreCreateCounting (max count > 1)
* Can be used from IRQ/ISR mode, but cannot be created/destroyed from such a context.
*/
class Semaphore {
private:
SemaphoreHandle_t handle;
public:
/**
* Cannot be called from IRQ/ISR mode.
* @param[in] maxCount The maximum count
* @param[in] initialCount The initial count
*/
Semaphore(uint32_t maxCount, uint32_t initialCount);
/** Cannot be called from IRQ/ISR mode. */
~Semaphore();
/** Acquire semaphore */
bool acquire(uint32_t timeout) const;
/** Release semaphore */
bool release() const;
/** @return semaphore count */
uint32_t getCount() const;
};
} // namespace