Cosmetics

This commit is contained in:
bsongis
2015-06-30 18:27:20 +02:00
parent 6abd888bf3
commit f9ff77ea7b
3 changed files with 32 additions and 36 deletions
+10 -12
View File
@@ -40,16 +40,20 @@
int usbPlugged(void)
{
//debounce
// debounce
static uint8_t debounced_state = 0;
static uint8_t last_state = 0;
if ( GPIO_ReadInputDataBit(USB_GPIO, USB_GPIO_PIN_VBUS) ) {
if (last_state) debounced_state = 1;
if (GPIO_ReadInputDataBit(USB_GPIO, USB_GPIO_PIN_VBUS)) {
if (last_state) {
debounced_state = 1;
}
last_state = 1;
}
else {
if (!last_state) debounced_state = 0;
if (!last_state) {
debounced_state = 0;
}
last_state = 0;
}
return debounced_state;
@@ -69,18 +73,13 @@ void usbInit(void)
void usbStart(void)
{
#if !defined(BOOT)
#if defined(USB_JOYSTICK)
//intialize USB as HID device
// initialize USB as HID device
USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_HID_cb, &USR_cb);
#elif defined(USB_MASS_STORAGE)
//intialize USB as MSC device
// initialize USB as MSC device
USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_MSC_cb, &USR_cb);
#endif
#else
//intialize USB as MSC device
USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_MSC_cb, &USR_cb);
#endif //!defined(BOOT)
}
#if defined(USB_JOYSTICK)
@@ -89,4 +88,3 @@ void usbStop(void)
USBD_DeInit(&USB_OTG_dev);
}
#endif