Skip to content

Commit f2a23cc

Browse files
committed
fix(uart): C wrapper to end related Serial object
1 parent 0a87a50 commit f2a23cc

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

cores/esp32/HardwareSerial.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,25 @@ extern void HWCDCSerialEvent(void) __attribute__((weak));
6666
extern "C" void hal_uart_notify_pins_detached(int uart_num) {
6767
log_d("hal_uart_notify_pins_detached: Notifying HardwareSerial for UART%d", uart_num);
6868
switch (uart_num) {
69-
case UART_NUM_0: Serial0.end(); break;
69+
case 0: Serial0.end(); break;
7070
#if SOC_UART_NUM > 1
71-
case UART_NUM_1: Serial1.end(); break;
71+
case 1: Serial1.end(); break;
7272
#endif
7373
#if SOC_UART_NUM > 2
74-
case UART_NUM_2: Serial2.end(); break;
74+
case 2: Serial2.end(); break;
7575
#endif
7676
#if SOC_UART_NUM > 3
77-
case UART_NUM_3: Serial3.end(); break;
77+
case 3: Serial3.end(); break;
7878
#endif
7979
#if SOC_UART_NUM > 4
80-
case UART_NUM_4: Serial4.end(); break;
80+
case 4: Serial4.end(); break;
8181
#endif
8282
#if SOC_UART_NUM > 5
83-
case UART_NUM_5: Serial5.end(); break;
83+
case 5: Serial5.end(); break;
8484
#endif
85-
default: break;
85+
default:
86+
log_e("hal_uart_notify_pins_detached: UART%d not handled!", uart_num);
87+
break;
8688
}
8789
}
8890

0 commit comments

Comments
 (0)