m2m_hw_usb_cable_check

UINT8 m2m_hw_usb_cable_check (void)

 

Description: The function checks if the USB cable is plugged in or not. The check is based on the reading of D+ and D- signals.

 

Return value:

1 when the USB cable is plugged in, USB_CABLE_ATTACHED.

0 when the USB cable is unplugged, USB_CABLE_DETACHED.

 

NOTE: the AppZone Layer provides the M2M_onUSbCableEvent(...) callback function, refer to document [1]. When the USB cable is plugged in, the execution of the callback starts automatically after a time interval that may span from few seconds to several seconds. When the cable is unplugged, the execution starts immediately. It is up to the programmer write the needed code inside the callback.