1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Added USB_LED_ON/USB_LED_OFF and checks to see if they are defined to the PIOS_USB_HID_ChangeConnectionState function ..

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1596 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pip 2010-09-12 10:47:20 +00:00 committed by pip
parent 9fca16db41
commit d0b8a9755d

View File

@ -118,14 +118,27 @@ int32_t PIOS_USB_HID_Init(uint32_t mode)
*/
int32_t PIOS_USB_HID_ChangeConnectionState(uint32_t Connected)
{
/* In all cases: re-initialise USB HID driver */
if(Connected) {
// In all cases: re-initialise USB HID driver
if (Connected)
{
transfer_possible = 1;
//TODO: Check SetEPRxValid(ENDP1);
} else {
/* Cable disconnected: disable transfers */
transfer_possible = 0;
#if defined(USB_LED_ON)
USB_LED_ON; // turn the USB led on
#endif
}
else
{
// Cable disconnected: disable transfers
transfer_possible = 0;
#if defined(USB_LED_OFF)
USB_LED_OFF; // turn the USB led off
#endif
}
return 0;
}