driver: timer: stm32_lptim: only set LSE drive if supported

Not all platforms support setting the LSE driving capability, causing
the build to fail for platform such as the STM32L072 if compiled with
CONFIG_STM32_LPTIM_CLOCK_LSE=y.

Adding an #ifdef guard around the call to skip it if not defined in the
HAL.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
This commit is contained in:
Fabio Baltieri 2022-07-08 01:26:06 +01:00
parent 6f108d7f76
commit 151d840f1e

View file

@ -279,7 +279,9 @@ static int sys_clock_driver_init(const struct device *dev)
/* enable LSE clock */
LL_RCC_LSE_DisableBypass();
#ifdef RCC_BDCR_LSEDRV_Pos
LL_RCC_LSE_SetDriveCapability(STM32_LSE_DRIVING << RCC_BDCR_LSEDRV_Pos);
#endif
LL_RCC_LSE_Enable();
while (!LL_RCC_LSE_IsReady()) {
/* Wait for LSE ready */