mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 11:10:14 +01:00
stm32/usbd: Introduce MICROPY_HW_USB_IS_MULTI_OTG to simplify USB config
This is an internal config value that is enabled for MCUs that have multiple OTG instances, to simplify #if configuration of the USB code.
This commit is contained in:
@@ -142,7 +142,7 @@ int8_t usbd_cdc_control(usbd_cdc_state_t *cdc_in, uint8_t cmd, uint8_t* pbuf, ui
|
||||
// configure its serial port (in most cases to disable local echo)
|
||||
cdc->connect_state = USBD_CDC_CONNECT_STATE_CONNECTING;
|
||||
usbd_cdc_connect_tx_timer = 8; // wait for 8 SOF IRQs
|
||||
#if defined(STM32L0) || defined(STM32WB)
|
||||
#if !MICROPY_HW_USB_IS_MULTI_OTG
|
||||
USB->CNTR |= USB_CNTR_SOFM;
|
||||
#else
|
||||
PCD_HandleTypeDef *hpcd = cdc->base.usbd->pdev->pData;
|
||||
@@ -219,7 +219,7 @@ void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd) {
|
||||
--usbd_cdc_connect_tx_timer;
|
||||
} else {
|
||||
usbd_cdc_msc_hid_state_t *usbd = ((USBD_HandleTypeDef*)hpcd->pData)->pClassData;
|
||||
#if defined(STM32L0) || defined(STM32WB)
|
||||
#if !MICROPY_HW_USB_IS_MULTI_OTG
|
||||
USB->CNTR &= ~USB_CNTR_SOFM;
|
||||
#else
|
||||
hpcd->Instance->GINTMSK &= ~USB_OTG_GINTMSK_SOFM;
|
||||
|
||||
Reference in New Issue
Block a user