From d0b8a9755d5d20e033bd3c399f360d44373469ea Mon Sep 17 00:00:00 2001 From: pip Date: Sun, 12 Sep 2010 10:47:20 +0000 Subject: [PATCH] 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 --- flight/PiOS/STM32F10x/pios_usb_hid.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/flight/PiOS/STM32F10x/pios_usb_hid.c b/flight/PiOS/STM32F10x/pios_usb_hid.c index 87b2bca6f..42a8f4b38 100644 --- a/flight/PiOS/STM32F10x/pios_usb_hid.c +++ b/flight/PiOS/STM32F10x/pios_usb_hid.c @@ -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; }