From 3cd72441bd57aa3342371b27c1a7c3abc7f3f67c Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Fri, 12 Jul 2019 14:58:33 +0200 Subject: [PATCH] cpu/stm32_common: minimize consumption for STM32L1 - With this PR all GPIOs are set as AIN on start up. Co-authored-by: Oleg Artamonov --- cpu/stm32_common/cpu_init.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cpu/stm32_common/cpu_init.c b/cpu/stm32_common/cpu_init.c index e64ba3f38b..769054074c 100644 --- a/cpu/stm32_common/cpu_init.c +++ b/cpu/stm32_common/cpu_init.c @@ -45,11 +45,16 @@ #if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F1) || \ defined(CPU_FAM_STM32F2) || defined(CPU_FAM_STM32F3) || \ - defined(CPU_FAM_STM32F4) || defined(CPU_FAM_STM32F7) + defined(CPU_FAM_STM32F4) || defined(CPU_FAM_STM32F7) || \ + defined(CPU_FAM_STM32L1) #define STM32_CPU_MAX_GPIOS (12U) -#if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F3) +#if defined(CPU_FAM_STM32L1) +#define GPIO_CLK (AHB) +#define GPIO_CLK_ENR (RCC->AHBENR) +#define GPIO_CLK_ENR_MASK (0x0000FFFF) +#elif defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F3) #define GPIO_CLK (AHB) #define GPIO_CLK_ENR (RCC->AHBENR) #define GPIO_CLK_ENR_MASK (0xFFFF0000) @@ -147,7 +152,8 @@ void cpu_init(void) stmclk_init_sysclk(); #if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F1) || \ defined(CPU_FAM_STM32F2) || defined(CPU_FAM_STM32F3) || \ - defined(CPU_FAM_STM32F4) || defined(CPU_FAM_STM32F7) + defined(CPU_FAM_STM32F4) || defined(CPU_FAM_STM32F7) || \ + defined(CPU_FAM_STM32L1) _gpio_init_ain(); #endif #ifdef MODULE_PERIPH_DMA