From e4fb414b913c9a5f0cdaa3aa0b715595a88ac3a9 Mon Sep 17 00:00:00 2001 From: Hierophect Date: Thu, 12 Dec 2019 17:17:29 -0500 Subject: [PATCH] clean up definitions post merge --- .../boards/meowbit_v121/mpconfigboard.h | 3 +++ .../common-hal/microcontroller/__init__.c | 2 +- ports/stm32f4/supervisor/usb.c | 20 +++++++++---------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ports/stm32f4/boards/meowbit_v121/mpconfigboard.h b/ports/stm32f4/boards/meowbit_v121/mpconfigboard.h index f2fe3ca804..eb526d0a75 100644 --- a/ports/stm32f4/boards/meowbit_v121/mpconfigboard.h +++ b/ports/stm32f4/boards/meowbit_v121/mpconfigboard.h @@ -35,6 +35,9 @@ #define AUTORESET_DELAY_MS 500 #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000) +#define BOARD_OSC_DIV 12 +#define BOARD_NO_VBUS + // On-board flash #define SPI_FLASH_MOSI_PIN (&pin_PB15) #define SPI_FLASH_MISO_PIN (&pin_PB14) diff --git a/ports/stm32f4/common-hal/microcontroller/__init__.c b/ports/stm32f4/common-hal/microcontroller/__init__.c index 16cc056c16..0c680eb055 100644 --- a/ports/stm32f4/common-hal/microcontroller/__init__.c +++ b/ports/stm32f4/common-hal/microcontroller/__init__.c @@ -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) }, #endif { 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) }, #endif { MP_ROM_QSTR(MP_QSTR_PB12), MP_ROM_PTR(&pin_PB12) }, diff --git a/ports/stm32f4/supervisor/usb.c b/ports/stm32f4/supervisor/usb.c index 6e9b233a47..3ebb74dc74 100644 --- a/ports/stm32f4/supervisor/usb.c +++ b/ports/stm32f4/supervisor/usb.c @@ -36,6 +36,16 @@ #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) { //TODO: if future chips overload this with options, move to peripherals management. @@ -89,13 +99,3 @@ void init_usb_hardware(void) { /* Peripheral clock 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 -}