]> granicus.if.org Git - esp-idf/commitdiff
bugfix(uart): Don't disable console UART peripheral
authorWangjialin <wangjialin@espressif.com>
Thu, 26 Oct 2017 09:18:08 +0000 (17:18 +0800)
committerAngus Gratton <gus@projectgus.com>
Fri, 27 Oct 2017 08:46:10 +0000 (16:46 +0800)
components/driver/uart.c

index 9ea92158cfa5fbaa4e922fbcffd25d3096143514..4a2a1640eae14508205f131b20faaefd8ecb86b3 100644 (file)
@@ -1140,12 +1140,14 @@ esp_err_t uart_driver_delete(uart_port_t uart_num)
     free(p_uart_obj[uart_num]);
     p_uart_obj[uart_num] = NULL;
 
-    if(uart_num == UART_NUM_0) {
-        periph_module_disable(PERIPH_UART0_MODULE);
-    } else if(uart_num == UART_NUM_1) {
-        periph_module_disable(PERIPH_UART1_MODULE);
-    } else if(uart_num == UART_NUM_2) {
-        periph_module_disable(PERIPH_UART2_MODULE);
+    if (uart_num != CONFIG_CONSOLE_UART_NUM ) {
+       if(uart_num == UART_NUM_0) {
+           periph_module_disable(PERIPH_UART0_MODULE);
+       } else if(uart_num == UART_NUM_1) {
+           periph_module_disable(PERIPH_UART1_MODULE);
+       } else if(uart_num == UART_NUM_2) {
+           periph_module_disable(PERIPH_UART2_MODULE);
+       }
     }
     return ESP_OK;
 }