File tree 1 file changed +22
-8
lines changed
1 file changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -394,17 +394,31 @@ void ICACHE_FLASH_ATTR uart_ignore_char(char c) {
394
394
}
395
395
396
396
void ICACHE_FLASH_ATTR uart0_write_char (char c) {
397
- if (c == ' \n ' ) {
398
- WRITE_PERI_REG (UART_FIFO (0 ), ' \r ' );
399
- }
400
- WRITE_PERI_REG (UART_FIFO (0 ), c);
397
+ if (&Serial != NULL && Serial.isTxEnabled ()) {
398
+ if (c == ' \n ' ) {
399
+ Serial.write (' \r ' );
400
+ }
401
+ Serial.write (c);
402
+ } else {
403
+ if (c == ' \n ' ) {
404
+ WRITE_PERI_REG (UART_FIFO (0 ), ' \r ' );
405
+ }
406
+ WRITE_PERI_REG (UART_FIFO (0 ), c);
407
+ }
401
408
}
402
409
403
410
void ICACHE_FLASH_ATTR uart1_write_char (char c) {
404
- if (c == ' \n ' ) {
405
- WRITE_PERI_REG (UART_FIFO (1 ), ' \r ' );
406
- }
407
- WRITE_PERI_REG (UART_FIFO (1 ), c);
411
+ if (&Serial1 != NULL && Serial1.isTxEnabled ()) {
412
+ if (c == ' \n ' ) {
413
+ Serial1.write (' \r ' );
414
+ }
415
+ Serial1.write (c);
416
+ } else {
417
+ if (c == ' \n ' ) {
418
+ WRITE_PERI_REG (UART_FIFO (1 ), ' \r ' );
419
+ }
420
+ WRITE_PERI_REG (UART_FIFO (1 ), c);
421
+ }
408
422
}
409
423
410
424
static UARTnr_t s_uart_debug_nr = UART_NO;
You can’t perform that action at this time.
0 commit comments