WIP: System Events

This commit is contained in:
Joe Kearney 2025-11-22 14:18:35 -06:00
parent 1c2f281579
commit c979c38fd7
46 changed files with 647 additions and 470 deletions

View file

@ -9,6 +9,7 @@ idf_component_register(
"."
REQUIRES
"SystemK"
"System_Events"
"spiffs"
"driver"
"usb"

View file

@ -20,6 +20,7 @@
*/
#include <SystemK.h>
#include <System_Events.h>
#include <string.h>
#include "esp_spiffs.h"
@ -80,5 +81,9 @@ void Initialize_SPIFFS(SemaphoreHandle_t init_complete)
fclose(f);
KLOG_INFO(TAG, ">>> %s <<<", buf);
xEventGroupSetBits(Get_System_Events(), SYS_SPIFFS_READY);
KLOG_INFO(TAG, "SPIFFS initialized.");
xSemaphoreGive(init_complete);
}

View file

@ -22,6 +22,7 @@
// From https://github.com/espressif/esp-idf/blob/master/examples/peripherals/usb/host/msc/main/msc_example_main.c
#include <SystemK.h>
#include <System_Events.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
@ -262,13 +263,11 @@ static void usb_host_task(void *args)
if (usb_host_device_free_all() == ESP_OK)
{
KLOG_INFO(TAG, "USB_HOST_LIB_EVENT_FLAGS_NO_CLIENTS");
// break;
};
}
if (event_flags & USB_HOST_LIB_EVENT_FLAGS_ALL_FREE)
{
KLOG_INFO(TAG, "USB_HOST_LIB_EVENT_FLAGS_ALL_FREE");
// break;
}
}
}
@ -356,6 +355,7 @@ static void app_usb_task(void *args)
else
{
Current_State = USB_STATE_VFS_REGISTERED;
xEventGroupSetBits(Get_System_Events(), SYS_USB_FS_PRESENT);
xSemaphoreGive(init_complete);
}
}
@ -371,6 +371,7 @@ static void app_usb_task(void *args)
if (msg.id == USB_DEVICE_DISCONNECTED)
{
Current_State = USB_STATE_PROCESSING_DISCONNECTION;
xEventGroupClearBits(Get_System_Events(), SYS_USB_FS_PRESENT);
}
}
vTaskDelay(pdMS_TO_TICKS(1000));