Skip to content

Commit 7881e68

Browse files
author
Marc Emmers
committed
STM32L0: Enable stop mode operation for the LPUART
1 parent 01660ff commit 7881e68

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

targets/TARGET_STM/serial_api.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,18 @@ HAL_StatusTypeDef init_uart(serial_t *obj)
525525
huart->Init.Mode = UART_MODE_TX_RX;
526526
}
527527

528+
#if defined(LPUART1_BASE)
529+
if (huart->Instance == LPUART1) {
530+
if (obj_s->baudrate <= 9600) {
531+
HAL_UARTEx_EnableClockStopMode(huart);
532+
HAL_UARTEx_EnableStopMode(huart);
533+
} else {
534+
HAL_UARTEx_DisableClockStopMode(huart);
535+
HAL_UARTEx_DisableStopMode(huart);
536+
}
537+
}
538+
#endif
539+
528540
return HAL_UART_Init(huart);
529541
}
530542

0 commit comments

Comments
 (0)