Skip to content

Commit 6c4fbf2

Browse files
committed
reduces number of debug messages
1 parent c443868 commit 6c4fbf2

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

cores/esp32/HWCDC.cpp

+26-9
Original file line numberDiff line numberDiff line change
@@ -242,24 +242,41 @@ void HWCDC::begin(unsigned long baud)
242242
log_e("HW CDC TX Buffer error");
243243
}
244244
}
245+
<<<<<<< Updated upstream
245246
// Setting USB D+ D- pins
247+
=======
248+
// Setting USB D+ D- pins || reduces number of debug messages
249+
>>>>>>> Stashed changes
246250
uint8_t pin = USB_DM_GPIO_NUM;
247-
if(perimanGetPinBusType(pin) != ESP32_BUS_TYPE_INIT){
248-
if(!perimanClearPinBus(pin)){
251+
if(perimanGetPinBusType(pin) != ESP32_BUS_TYPE_USB_DM){
252+
if(perimanGetPinBusType(pin) != ESP32_BUS_TYPE_INIT){
253+
if(!perimanClearPinBus(pin)){
254+
goto err;
255+
}
256+
}
257+
if(!perimanSetPinBus(pin, ESP32_BUS_TYPE_USB_DM, (void *) this, -1, -1)){
249258
goto err;
250259
}
251260
}
252-
if(!perimanSetPinBus(pin, ESP32_BUS_TYPE_USB_DM, (void *) this, -1, -1)){
253-
goto err;
254-
}
255261
pin = USB_DP_GPIO_NUM;
256-
if(perimanGetPinBusType(pin) != ESP32_BUS_TYPE_INIT){
257-
if(!perimanClearPinBus(pin)){
262+
if(perimanGetPinBusType(pin) != ESP32_BUS_TYPE_USB_DP){
263+
if(perimanGetPinBusType(pin) != ESP32_BUS_TYPE_INIT){
264+
if(!perimanClearPinBus(pin)){
265+
goto err;
266+
}
267+
}
268+
if(!perimanSetPinBus(pin, ESP32_BUS_TYPE_USB_DP, (void *) this, -1, -1)){
258269
goto err;
259270
}
260271
}
261-
if(!perimanSetPinBus(pin, ESP32_BUS_TYPE_USB_DP, (void *) this, -1, -1)){
262-
goto err;
272+
// Configure PHY
273+
usb_phy_ll_int_jtag_enable(&USB_SERIAL_JTAG);
274+
usb_serial_jtag_ll_disable_intr_mask(USB_SERIAL_JTAG_LL_INTR_MASK);
275+
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY | USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT | USB_SERIAL_JTAG_INTR_BUS_RESET);
276+
if(!intr_handle && esp_intr_alloc(ETS_USB_SERIAL_JTAG_INTR_SOURCE, 0, hw_cdc_isr_handler, NULL, &intr_handle) != ESP_OK){
277+
isr_log_e("HW USB CDC failed to init interrupts");
278+
end();
279+
return;
263280
}
264281
// Configure PHY
265282
usb_phy_ll_int_jtag_enable(&USB_SERIAL_JTAG);

0 commit comments

Comments
 (0)