2021-01-07 01:37 PM
Hi,
I'm using my stm32 as a USB HID device and I would like to be able to detect when the host computer goes into sleep mode and when it resumes. How would I detect this change?
I tried checking the following continuously in the main loop but detected no change:
if(((USBD_HandleTypeDef*)hpcd_USB_FS.pData)->dev_state==USBD_STATE_SUSPENDED){
Am I missing something or is there a better way?
2021-01-08 11:19 AM
JW
2021-01-08 11:28 AM
.
2021-01-08 11:28 AM
This seems to be talking about OTG devices, but I'm just a regular FS usb device
2021-01-08 04:35 PM
You did not care to tell us which STM32 are you using, and my crystal cube told me the wrong one. So one more guess:
JW
2021-01-08 04:58 PM
Thanks for the reply, The device is an stm32L151C8T6A
I'm doing the following check continuously in the main loop
if(USB_ISTR & USB_ISTR_SUSP){
The bit seems always to be 1. Is there something else I need to enable to make this work?