2026-04-15 09:30:40 +08:00
|
|
|
#ifndef BLINKY_USB_STATE_EVENT_H_
|
|
|
|
|
#define BLINKY_USB_STATE_EVENT_H_
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
|
#include <app_event_manager.h>
|
|
|
|
|
#include <app_event_manager_profiler_tracer.h>
|
|
|
|
|
#include <zephyr/sys/util.h>
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2026-04-15 15:13:44 +08:00
|
|
|
enum usb_state {
|
|
|
|
|
USB_STATE_DISABLED = 0,
|
|
|
|
|
USB_STATE_DISCONNECTED,
|
|
|
|
|
USB_STATE_POWERED,
|
|
|
|
|
USB_STATE_ACTIVE,
|
|
|
|
|
USB_STATE_SUSPENDED,
|
2026-04-15 09:30:40 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct usb_state_event {
|
|
|
|
|
struct app_event_header header;
|
2026-04-15 15:13:44 +08:00
|
|
|
enum usb_state state;
|
2026-04-15 09:30:40 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
APP_EVENT_TYPE_DECLARE(usb_state_event);
|
|
|
|
|
|
2026-04-15 15:13:44 +08:00
|
|
|
static inline void submit_usb_state(enum usb_state state)
|
2026-04-15 09:30:40 +08:00
|
|
|
{
|
|
|
|
|
struct usb_state_event *event = new_usb_state_event();
|
|
|
|
|
|
2026-04-15 15:13:44 +08:00
|
|
|
event->state = state;
|
2026-04-15 09:30:40 +08:00
|
|
|
APP_EVENT_SUBMIT(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* BLINKY_USB_STATE_EVENT_H_ */
|