Is it possible to tell if the USB is connected to a wall-charger as opposed to a PC?
Is it possible to tell if the USB is connected to a wall-charger as opposed to a PC?
Hello,
I have not checked exactly which events that are the best to check for, but you can figure out quite fast whether you get some USB events or not. If you don't get the USB events in a couple of seconds, you can conclude that you are only receiving power through the USB, and that you are connected to a wall-charger.
Best regards,
Edvin
I'm understand that topic is outdated, but it might be useful for those who has the same problem.
I added APP_USBD_EVT_DRV_SOF case to usbd_user_ev_handler() . If device is connected to wall charger SOF event would never come, so it can be easiest way to distinguish whether it plugged to USB host or not. At least this trick is works for me.