Hi,
Wondering how to detect when the user plugs in a USB cable, or when the battery charger starts or stops charging? I haven't seen this in the documentation yet, but it appears Dialog has provided us with a rich set of callbacks in sdk/cpm/sys_charger.c that applications can implement to handle USB and charger lifecycle events. For example:
usb_attach_cb(): Called when the user connects a USB cable (looks for a transition in the voltage on VBUS, I believe)
usb_detach_cb(): Called when the user removes the USB cable
usb_charging()
usb_charged()
usb_charger_battery_full()
...
Hope this helps others looking to adjust their applications' behavior on USB connection events and as the charger transitions states.
David
Keywords:
Device:
Adding a comment so I can close the topic.
David
Hi david_33021,
In order to get notified that something is pluged on your USB device the VBUS_Handler() will occur and eventually the usb_attach_cb() function will occur if that is your question.
Thanks MT_dialog