aboutsummaryrefslogtreecommitdiff
path: root/ports/stm32/stm32_it.c
diff options
context:
space:
mode:
authorDamien George2018-02-13 18:51:08 +1100
committerDamien George2018-02-13 18:51:08 +1100
commit5c320bd0b093f44cad19046d84a63e5ed4e7fc87 (patch)
treec059deb480a12d08b72fc1936a3c7ed78d3c8b2c /ports/stm32/stm32_it.c
parent8aad22fdca757fd7135fb2f68ff8023a1f5bebc3 (diff)
stm32: Introduce MICROPY_HW_ENABLE_USB and clean up USB config.
This patch allows to completely compile-out support for USB, and no-USB is now the default. If a board wants to enable USB it should define: #define MICROPY_HW_ENABLE_USB (1) And then one or more of the following to select the USB PHY: #define MICROPY_HW_USB_FS (1) #define MICROPY_HW_USB_HS (1) #define MICROPY_HW_USB_HS_IN_FS (1)
Diffstat (limited to 'ports/stm32/stm32_it.c')
-rw-r--r--ports/stm32/stm32_it.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ports/stm32/stm32_it.c b/ports/stm32/stm32_it.c
index f1ac9b6b8..f933250b1 100644
--- a/ports/stm32/stm32_it.c
+++ b/ports/stm32/stm32_it.c
@@ -143,9 +143,11 @@ void HardFault_C_Handler(ExceptionRegisters_t *regs) {
NVIC_SystemReset();
}
+ #if MICROPY_HW_ENABLE_USB
// We need to disable the USB so it doesn't try to write data out on
// the VCP and then block indefinitely waiting for the buffer to drain.
pyb_usb_flags = 0;
+ #endif
mp_hal_stdout_tx_str("HardFault\r\n");
@@ -337,14 +339,14 @@ void SysTick_Handler(void) {
* @param None
* @retval None
*/
-#if defined(USE_USB_FS)
+#if MICROPY_HW_USB_FS
void OTG_FS_IRQHandler(void) {
IRQ_ENTER(OTG_FS_IRQn);
HAL_PCD_IRQHandler(&pcd_fs_handle);
IRQ_EXIT(OTG_FS_IRQn);
}
#endif
-#if defined(USE_USB_HS)
+#if MICROPY_HW_USB_HS
void OTG_HS_IRQHandler(void) {
IRQ_ENTER(OTG_HS_IRQn);
HAL_PCD_IRQHandler(&pcd_hs_handle);
@@ -352,7 +354,7 @@ void OTG_HS_IRQHandler(void) {
}
#endif
-#if defined(USE_USB_FS) || defined(USE_USB_HS)
+#if MICROPY_HW_USB_FS || MICROPY_HW_USB_HS
/**
* @brief This function handles USB OTG Common FS/HS Wakeup functions.
* @param *pcd_handle for FS or HS
@@ -393,7 +395,7 @@ STATIC void OTG_CMD_WKUP_Handler(PCD_HandleTypeDef *pcd_handle) {
}
#endif
-#if defined(USE_USB_FS)
+#if MICROPY_HW_USB_FS
/**
* @brief This function handles USB OTG FS Wakeup IRQ Handler.
* @param None
@@ -411,7 +413,7 @@ void OTG_FS_WKUP_IRQHandler(void) {
}
#endif
-#if defined(USE_USB_HS)
+#if MICROPY_HW_USB_HS
/**
* @brief This function handles USB OTG HS Wakeup IRQ Handler.
* @param None