2025-02-16 00:02:20 +01:00

99 lines
1.8 KiB
C++

/**
* @file
* @brief Implementation of system events.
*/
#ifndef STA_TACOS_SYSTEM_EVENTS_HPP
#define STA_TACOS_SYSTEM_EVENTS_HPP
/**
* @defgroup STA_RTOS_SysEvent System Events
* @ingroup STA_RTOS_API
* @brief System events.
*
* Check @ref STA_RTOS_BuildConfig for configuration options.
*/
#include <cstdint>
// System event flags
//
/**
* @brief Startup system event flag.
*
* @ingroup STA_RTOS_SysEvent
*/
#define STA_TACOS_SYSTEM_EVENTS_STARTUP 0x100000U
namespace sta
{
namespace tacos
{
namespace events
{
enum class Types : uint32_t
{
STARTUP = 0x01,
TICK_100Hz = 0x02,
TOCK_100Hz = 0x03,
TICK_50Hz = 0x04,
TOCK_50Hz = 0x05,
TICK_20Hz = 0x06,
TOCK_20Hz = 0x07,
TICK_10Hz = 0x08,
TOCK_10Hz = 0x09,
TICK_1Hz = 0x0A,
TOCK_1Hz = 0x0B
};
/**
* @brief Initialize system events.
*/
void init();
/**
* @brief Signal system events.
*
* @param flags System event flags
*
* @ingroup STA_RTOS_SysEvent
*/
void signal(uint32_t flags);
/**
* @brief Wait for system events.
*
* @param flags System event flags
* @param options osFlagsWaitAll or osFlagsWaitAny (osFlagsNoClear always set)
* @param timeout Wait timeout (0 = instant, osWaitForever = infinite)
*
* @ingroup STA_RTOS_SysEvent
*/
void wait(uint32_t flags, uint32_t options, uint32_t timeout);
/**
* @brief Signal startup system event.
*
* @ingroup STA_RTOS_SysEvent
*/
void signalStartup();
/**
* @brief Wait for startup system event.
*
* Blocking while waiting
*
* @ingroup STA_RTOS_SysEvent
*/
void waitForStartup();
} // namespace events
} // namespace tacos
} // namespace sta
#endif // STA_RTOS_SYSTEM_EVENTS_HPP