Skip to content

Commit e731329

Browse files
committed
fixes
1 parent 13a83ce commit e731329

File tree

1 file changed

+7
-25
lines changed

1 file changed

+7
-25
lines changed

Diff for: cores/esp32/HWCDC.cpp

+7-25
Original file line numberDiff line numberDiff line change
@@ -243,34 +243,16 @@ void HWCDC::begin(unsigned long baud)
243243
}
244244
}
245245

246-
#if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2
247-
// the HW Serial pins needs to be first deinited in order to allow `if(Serial)` to work :-(
246+
// the HW Serial pins needs to be first deinited in order to allow `if(Serial)` to work :-(
248247
deinit(NULL);
249-
delay(10);
250-
#endif
251-
// Setting USB D+ D- pins || reduces number of debug messages
248+
delay(10); // USB Host has to enumerate it again
249+
250+
// Peripheral Manager setting for USB D+ D- pins
252251
uint8_t pin = USB_DM_GPIO_NUM;
253-
if(perimanGetPinBusType(pin) != ESP32_BUS_TYPE_USB_DM){
254-
if(perimanGetPinBusType(pin) != ESP32_BUS_TYPE_INIT){
255-
if(!perimanClearPinBus(pin)){
256-
goto err;
257-
}
258-
}
259-
if(!perimanSetPinBus(pin, ESP32_BUS_TYPE_USB_DM, (void *) this, -1, -1)){
260-
goto err;
261-
}
262-
}
252+
if(!perimanSetPinBus(pin, ESP32_BUS_TYPE_USB_DM, (void *) this, -1, -1)) goto err;
263253
pin = USB_DP_GPIO_NUM;
264-
if(perimanGetPinBusType(pin) != ESP32_BUS_TYPE_USB_DP){
265-
if(perimanGetPinBusType(pin) != ESP32_BUS_TYPE_INIT){
266-
if(!perimanClearPinBus(pin)){
267-
goto err;
268-
}
269-
}
270-
if(!perimanSetPinBus(pin, ESP32_BUS_TYPE_USB_DP, (void *) this, -1, -1)){
271-
goto err;
272-
}
273-
}
254+
if(!perimanSetPinBus(pin, ESP32_BUS_TYPE_USB_DP, (void *) this, -1, -1)) goto err;
255+
274256
// Configure PHY
275257
// USB_Serial_JTAG use internal PHY
276258
USB_SERIAL_JTAG.conf0.phy_sel = 0;

0 commit comments

Comments
 (0)