Converted initialization to use System Events.

This commit is contained in:
Joe Kearney 2025-11-23 16:01:02 -06:00
parent 0dcbae7ec6
commit c3362d42af
17 changed files with 243 additions and 58 deletions

View file

@ -38,4 +38,22 @@ void Initialize_System_Events(void)
EventGroupHandle_t Get_System_Events(void)
{
return The_System_Events;
}
}
bool Wait_For_System_Event(EventBits_t event_bit, const char* timeout_message, uint32_t timeout_ms)
{
EventBits_t bits = xEventGroupWaitBits(
The_System_Events,
event_bit,
pdFALSE,
pdTRUE,
pdMS_TO_TICKS(timeout_ms));
if ((bits & event_bit) == 0)
{
KLOG_ERROR(TAG, "%s", timeout_message);
return false;
}
return true;
}

View file

@ -31,11 +31,13 @@
#define SYS_NVS_READY (1 << 0)
#define SYS_SPIFFS_READY (1 << 1)
#define SYS_USB_FS_PRESENT (1 << 2)
#define SYS_BLE_READY (1 << 3)
#define SYS_AUDIO_READY (1 << 4)
#define SYS_CONFIG_LOADED (1 << 5)
#define SYS_AUDIO_READY (1 << 3)
#define SYS_NEOPIXELS_READY (1 << 4)
#define SYS_BLE_READY (1 << 5)
#define SYS_IR_READY (1 << 6)
EventGroupHandle_t Get_System_Events(void);
void Initialize_System_Events(void);
bool Wait_For_System_Event(EventBits_t event_bit, const char* timeout_message, uint32_t timeout_ms);
#endif // SYSTEM_EVENTS_H