feat: add support for H7 USB voltage detector (#5423)
This commit is contained in:
@@ -78,6 +78,7 @@ extern "C" {
|
|||||||
#include "STM32H7xx_HAL_Driver/Inc/stm32h7xx_ll_spi.h"
|
#include "STM32H7xx_HAL_Driver/Inc/stm32h7xx_ll_spi.h"
|
||||||
#include "STM32H7xx_HAL_Driver/Inc/stm32h7xx_ll_iwdg.h"
|
#include "STM32H7xx_HAL_Driver/Inc/stm32h7xx_ll_iwdg.h"
|
||||||
#include "STM32H7xx_HAL_Driver/Inc/stm32h7xx_ll_usb.h"
|
#include "STM32H7xx_HAL_Driver/Inc/stm32h7xx_ll_usb.h"
|
||||||
|
#include "STM32H7xx_HAL_Driver/Inc/stm32h7xx_ll_pwr.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
|
|||||||
@@ -118,6 +118,10 @@ void usbInit()
|
|||||||
#error "Unable to enable USB peripheral clock"
|
#error "Unable to enable USB peripheral clock"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(STM32H7) || defined(STM32H7RS)
|
||||||
|
LL_PWR_EnableUSBVoltageDetector();
|
||||||
|
#endif
|
||||||
|
|
||||||
usbDriverStarted = false;
|
usbDriverStarted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,8 +164,10 @@ void usbStart()
|
|||||||
//USBD_Init(&hUsbDeviceFS, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_MSC_cb, &USR_cb);
|
//USBD_Init(&hUsbDeviceFS, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_MSC_cb, &USR_cb);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
USBD_Start(&hUsbDeviceFS);
|
|
||||||
usbDriverStarted = true;
|
if (USBD_Start(&hUsbDeviceFS) == USBD_OK) {
|
||||||
|
usbDriverStarted = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void usbStop()
|
void usbStop()
|
||||||
|
|||||||
Reference in New Issue
Block a user