STM32L0: Enable stop mode operation for the LPUART

pull/5941/head
Marc Emmers 2018-01-25 17:24:57 +01:00
parent 01660ff5ae
commit 7881e68efe
1 changed files with 12 additions and 0 deletions

View File

@ -525,6 +525,18 @@ HAL_StatusTypeDef init_uart(serial_t *obj)
huart->Init.Mode = UART_MODE_TX_RX;
}
#if defined(LPUART1_BASE)
if (huart->Instance == LPUART1) {
if (obj_s->baudrate <= 9600) {
HAL_UARTEx_EnableClockStopMode(huart);
HAL_UARTEx_EnableStopMode(huart);
} else {
HAL_UARTEx_DisableClockStopMode(huart);
HAL_UARTEx_DisableStopMode(huart);
}
}
#endif
return HAL_UART_Init(huart);
}