* USB Joystick implemented
* USB Mass storage mode removed from openTX (this is now supported by Bootloader)
This commit is contained in:
+5
-3
@@ -159,14 +159,16 @@ void USBD_Init(USB_OTG_CORE_HANDLE *pdev,
|
||||
|
||||
/**
|
||||
* @brief USBD_DeInit
|
||||
* Re-Initialize th device library
|
||||
* Deinitialize USB device library
|
||||
* @param pdev: device instance
|
||||
* @retval status: status
|
||||
*/
|
||||
USBD_Status USBD_DeInit(USB_OTG_CORE_HANDLE *pdev)
|
||||
{
|
||||
/* Software Init */
|
||||
|
||||
/*Disable Interrupts*/
|
||||
USB_OTG_BSP_DisableInterrupt(pdev);
|
||||
USB_OTG_DisableGlobalInt(pdev);
|
||||
USB_OTG_BSP_Deinit(pdev);
|
||||
return USBD_OK;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -78,9 +78,11 @@
|
||||
void BSP_Init(void);
|
||||
|
||||
void USB_OTG_BSP_Init (USB_OTG_CORE_HANDLE *pdev);
|
||||
void USB_OTG_BSP_Deinit(USB_OTG_CORE_HANDLE *pdev);
|
||||
void USB_OTG_BSP_uDelay (const uint32_t usec);
|
||||
void USB_OTG_BSP_mDelay (const uint32_t msec);
|
||||
void USB_OTG_BSP_EnableInterrupt (USB_OTG_CORE_HANDLE *pdev);
|
||||
void USB_OTG_BSP_DisableInterrupt (USB_OTG_CORE_HANDLE *pdev);
|
||||
#ifdef USE_HOST_MODE
|
||||
void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev);
|
||||
void USB_OTG_BSP_DriveVBUS(USB_OTG_CORE_HANDLE *pdev,uint8_t state);
|
||||
|
||||
+30
@@ -470,6 +470,36 @@ static uint32_t DCD_HandleInEP_ISR(USB_OTG_CORE_HANDLE *pdev)
|
||||
}
|
||||
if (diepint.b.emptyintr)
|
||||
{
|
||||
/*===============ADDED SECTION ==============================*/
|
||||
/*
|
||||
This only applies to INTERRUPT transfer mode.
|
||||
|
||||
diepint.b.emptyintr interrupt can't be reset by writing 1 to
|
||||
DIEPINT register. According to reference manual, this bit
|
||||
is read-only.
|
||||
|
||||
The CLEAR_IN_EP_INTR(epnum, emptyintr) does not work!
|
||||
|
||||
The only way to stop this interrupt is to disable it using
|
||||
mask register DIEPEMPMSK.
|
||||
|
||||
Original code gets here, is unsuccessful at interrupt flag reset
|
||||
and when interrupt handler returns, another one is fired again,
|
||||
robbing CPU time, which is then spent only in interrupt handlers
|
||||
(this one and all other that have higher priority)
|
||||
|
||||
This only happens in HID mode (when interrupt in endpoint is
|
||||
used) and when host is not actively polling device (us) for
|
||||
update. This is situation on Linux when no program is using
|
||||
joystick. The kernel/joystick driver stops polling device.
|
||||
|
||||
*/
|
||||
if ( pdev->dev.in_ep[epnum].type == USB_OTG_EP_INT ) {
|
||||
|
||||
fifoemptymsk = 0x1 << epnum;
|
||||
USB_OTG_MODIFY_REG32(&pdev->regs.DREGS->DIEPEMPMSK, fifoemptymsk, 0);
|
||||
}
|
||||
/*===============END OF ADDED SECTION ==============================*/
|
||||
|
||||
DCD_WriteEmptyTxFifo(pdev , epnum);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user