@@ -243,34 +243,16 @@ void HWCDC::begin(unsigned long baud)
243
243
}
244
244
}
245
245
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 :-(
248
247
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
252
251
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;
263
253
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
+
274
256
// Configure PHY
275
257
// USB_Serial_JTAG use internal PHY
276
258
USB_SERIAL_JTAG.conf0 .phy_sel = 0 ;
0 commit comments