File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 32
32
#include "lib/mp-readline/readline.h"
33
33
#include "stm32f4xx_hal.h"
34
34
35
+ #include "py/mpconfig.h"
36
+
35
37
#include "common-hal/microcontroller/Pin.h"
36
38
37
39
void init_usb_hardware (void ) {
@@ -79,7 +81,21 @@ void init_usb_hardware(void) {
79
81
HAL_GPIO_Init (GPIOG , & GPIO_InitStruct );
80
82
never_reset_pin_number (0 , 8 );
81
83
#endif
84
+
85
+ #ifdef BOARD_NO_VBUS
86
+ disable_usb_vbus ();
87
+ #endif
82
88
83
89
/* Peripheral clock enable */
84
90
__HAL_RCC_USB_OTG_FS_CLK_ENABLE ();
85
91
}
92
+
93
+ STATIC void disable_usb_vbus (void ) {
94
+ #ifdef USB_OTG_GCCFG_VBDEN
95
+ USB_OTG_FS -> GCCFG &= ~USB_OTG_GCCFG_VBDEN ;
96
+ #else
97
+ USB_OTG_FS -> GCCFG |= USB_OTG_GCCFG_NOVBUSSENS ;
98
+ USB_OTG_FS -> GCCFG &= ~USB_OTG_GCCFG_VBUSBSEN ;
99
+ USB_OTG_FS -> GCCFG &= ~USB_OTG_GCCFG_VBUSASEN ;
100
+ #endif
101
+ }
You can’t perform that action at this time.
0 commit comments