clean up definitions post merge

This commit is contained in:
Hierophect 2019-12-12 17:17:29 -05:00
parent ab3762d8f5
commit e4fb414b91
3 changed files with 14 additions and 11 deletions

View File

@ -35,6 +35,9 @@
#define AUTORESET_DELAY_MS 500 #define AUTORESET_DELAY_MS 500
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000) #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000)
#define BOARD_OSC_DIV 12
#define BOARD_NO_VBUS
// On-board flash // On-board flash
#define SPI_FLASH_MOSI_PIN (&pin_PB15) #define SPI_FLASH_MOSI_PIN (&pin_PB15)
#define SPI_FLASH_MISO_PIN (&pin_PB14) #define SPI_FLASH_MISO_PIN (&pin_PB14)

View File

@ -169,7 +169,7 @@ STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_PE15), MP_ROM_PTR(&pin_PE15) }, { MP_ROM_QSTR(MP_QSTR_PE15), MP_ROM_PTR(&pin_PE15) },
#endif #endif
{ MP_ROM_QSTR(MP_QSTR_PB10), MP_ROM_PTR(&pin_PB10) }, { MP_ROM_QSTR(MP_QSTR_PB10), MP_ROM_PTR(&pin_PB10) },
#if MCU_PACKAGE == 144 #if MCU_PACKAGE == 144 || defined STM32F405xx
{ MP_ROM_QSTR(MP_QSTR_PB11), MP_ROM_PTR(&pin_PB11) }, { MP_ROM_QSTR(MP_QSTR_PB11), MP_ROM_PTR(&pin_PB11) },
#endif #endif
{ MP_ROM_QSTR(MP_QSTR_PB12), MP_ROM_PTR(&pin_PB12) }, { MP_ROM_QSTR(MP_QSTR_PB12), MP_ROM_PTR(&pin_PB12) },

View File

@ -36,6 +36,16 @@
#include "common-hal/microcontroller/Pin.h" #include "common-hal/microcontroller/Pin.h"
STATIC void disable_usb_vbus(void) {
#ifdef USB_OTG_GCCFG_VBDEN
USB_OTG_FS->GCCFG &= ~USB_OTG_GCCFG_VBDEN;
#else
USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_NOVBUSSENS;
USB_OTG_FS->GCCFG &= ~USB_OTG_GCCFG_VBUSBSEN;
USB_OTG_FS->GCCFG &= ~USB_OTG_GCCFG_VBUSASEN;
#endif
}
void init_usb_hardware(void) { void init_usb_hardware(void) {
//TODO: if future chips overload this with options, move to peripherals management. //TODO: if future chips overload this with options, move to peripherals management.
@ -89,13 +99,3 @@ void init_usb_hardware(void) {
/* Peripheral clock enable */ /* Peripheral clock enable */
__HAL_RCC_USB_OTG_FS_CLK_ENABLE(); __HAL_RCC_USB_OTG_FS_CLK_ENABLE();
} }
STATIC void disable_usb_vbus(void) {
#ifdef USB_OTG_GCCFG_VBDEN
USB_OTG_FS->GCCFG &= ~USB_OTG_GCCFG_VBDEN;
#else
USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_NOVBUSSENS;
USB_OTG_FS->GCCFG &= ~USB_OTG_GCCFG_VBUSBSEN;
USB_OTG_FS->GCCFG &= ~USB_OTG_GCCFG_VBUSASEN;
#endif
}