Skip to content

Commit e382064

Browse files
committed
Fix conditional compilation usage for serial ports
1 parent 6653e31 commit e382064

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

cores/arduino/HardwareSerial.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#if defined(HAL_UART_MODULE_ENABLED)
3434
#if defined(HAVE_HWSERIAL1) || defined(HAVE_HWSERIAL2) || defined(HAVE_HWSERIAL3) ||\
3535
defined(HAVE_HWSERIAL4) || defined(HAVE_HWSERIAL5) || defined(HAVE_HWSERIAL6) ||\
36-
defined(HAVE_HWSERIAL7) || defined(HAVE_HWSERIAL8) || defined(HAVE_HWSERIAL8) ||\
36+
defined(HAVE_HWSERIAL7) || defined(HAVE_HWSERIAL8) || defined(HAVE_HWSERIAL9) ||\
3737
defined(HAVE_HWSERIAL10) || defined(HAVE_HWSERIALLP1)
3838
// SerialEvent functions are weak, so when the user doesn't define them,
3939
// the linker just sets their address to 0 (which is checked below).
@@ -358,7 +358,7 @@ void HardwareSerial::flush()
358358

359359
while((_serial.tx_head != _serial.tx_tail)) {
360360
// nop, the interrupt handler will free up space for us
361-
__WFI();
361+
__WFI();
362362
}
363363
// If we get here, nothing is queued anymore (DRIE is disabled) and
364364
// the hardware finished tranmission (TXC is set).
@@ -374,7 +374,7 @@ size_t HardwareSerial::write(uint8_t c)
374374
// wait for the interrupt handler to empty it a bit
375375
while (i == _serial.tx_tail) {
376376
// nop, the interrupt handler will free up space for us
377-
__WFI();
377+
__WFI();
378378
}
379379

380380
_serial.tx_buff[_serial.tx_head] = c;

cores/arduino/stm32/uart.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ void uart_deinit(serial_t *obj)
466466
__HAL_RCC_UART9_CLK_DISABLE();
467467
break;
468468
#endif
469-
#if defined(HAVE_HWSERIAL9)
469+
#if defined(HAVE_HWSERIAL10)
470470
case 9:
471471
__HAL_RCC_UART10_FORCE_RESET();
472472
__HAL_RCC_UART10_RELEASE_RESET();
@@ -901,18 +901,18 @@ void USART3_IRQHandler(void)
901901
#endif
902902
#if defined(STM32F0xx)
903903
/* USART3_4_IRQn */
904-
#if defined(ENABLE_HWSERIAL3)
904+
#if defined(ENABLE_HWSERIAL4)
905905
if(uart_handlers[3] != NULL) {
906906
HAL_UART_IRQHandler(uart_handlers[3]);
907907
}
908908
#endif
909909
#if defined(STM32F030xC)
910-
#if defined(ENABLE_HWSERIAL4)
910+
#if defined(ENABLE_HWSERIAL5)
911911
if(uart_handlers[4] != NULL) {
912912
HAL_UART_IRQHandler(uart_handlers[4]);
913913
}
914914
#endif
915-
#if defined(ENABLE_HWSERIAL5)
915+
#if defined(ENABLE_HWSERIAL6)
916916
if(uart_handlers[5] != NULL) {
917917
HAL_UART_IRQHandler(uart_handlers[5]);
918918
}

0 commit comments

Comments
 (0)