- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a USB HID device that I want to wake up when the computer wakes up. How do I check when the computer wakes up? Is there an event produced? I can wake up the computer using CyU3PUsbDoRemoteWakeup, but I don't know how to wake up the device if something else wakes up the computer.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Yes, you can make use of the event CY_U3P_USB_EVENT_RESUME on the device side to check if the host woke the device from suspend or not.
The API CyU3PEventGet () should be used for clearing the event flag.
Please refer to the documentation of the API CyU3PEventGet and CyU3PEventSet in the FX3 API guide which provides details about these APIs.
The API CyU3PEventSet () has 3 parameters. The second parameter is just a bit mask that is used to select a flag of interest. It is not used for setting or clearing the flag, it just identifies the flag of concern. The 3rd parameter is used for providing set the kind of set operation to be performed. This parameter do not have a setting to clear any event flags.
The API CyU3PEventGet () has 5 parameters. Here also, the second parameter is used to choose the flag of interest. But the 3rd parameter has settings to read and clear the flags. So, the API CyU3PEventGet () should be used to clear the event flag.
Jayakrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think I figured out that it has to be done in the CY_U3P_USB_EVENT_RESUME callback event -- but I'm confused on how to clear my own event flag:
CyU3PEventSet(&event_group_init,
~EVENT_USB_SUSPENDED,
CYU3P_EVENT_AND);
I thought this would clear the "EVENT_USB_SUSPENDED" from the "event_group_init" event group, but it doesn't. I had to use:
CyU3PEventGet(&event_group_init,
EVENT_USB_SUSPENDED,
CYU3P_EVENT_AND_CLEAR,
&event_status,
CYU3P_NO_WAIT);
Can someone explain to me why Set doesn't let me clear the event, but Get does?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Yes, you can make use of the event CY_U3P_USB_EVENT_RESUME on the device side to check if the host woke the device from suspend or not.
The API CyU3PEventGet () should be used for clearing the event flag.
Please refer to the documentation of the API CyU3PEventGet and CyU3PEventSet in the FX3 API guide which provides details about these APIs.
The API CyU3PEventSet () has 3 parameters. The second parameter is just a bit mask that is used to select a flag of interest. It is not used for setting or clearing the flag, it just identifies the flag of concern. The 3rd parameter is used for providing set the kind of set operation to be performed. This parameter do not have a setting to clear any event flags.
The API CyU3PEventGet () has 5 parameters. Here also, the second parameter is used to choose the flag of interest. But the 3rd parameter has settings to read and clear the flags. So, the API CyU3PEventGet () should be used to clear the event flag.
Jayakrishna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to note, for anyone checking this topic in the future, that CY_U3P_USB_EVENT_SETCONF will be called after a DISCONNECT event, so you can use that during a restart.