Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbccdb75

Browse files
authored
fix(uart): prevent deinitializing another UART
If called from an uninitialized HardwareSerial, the code unintentionally deinit the UART at uart_handlers[0]
1 parent227cec0 commitbccdb75

File tree

1 file changed

+3
-0
lines changed
  • libraries/SrcWrapper/src/stm32

1 file changed

+3
-0
lines changed

‎libraries/SrcWrapper/src/stm32/uart.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,9 @@ bool uart_init(serial_t *obj, uint32_t baudrate, uint32_t databits, uint32_t par
594594
*/
595595
voiduart_deinit(serial_t*obj)
596596
{
597+
/* Prevent deinitializing another UART in case this has not been initialized */
598+
if (!obj->uart)return;
599+
597600
/* Reset UART and disable clock */
598601
switch (obj->index) {
599602
#if defined(USART1_BASE)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp