Skip to content

Commit 3751275

Browse files
cybertalegalak
authored andcommitted
drivers: gpio: stm32: add ASCR configuration for L47x+
For STM32L47x/48x series devices, register ASCR should be configured to connect analog switch of gpio lines to the ADC. Signed-off-by: Song Qiang <[email protected]>
1 parent 25ea5fe commit 3751275

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/gpio/gpio_stm32.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,16 @@ int gpio_stm32_configure(u32_t *base_addr, int pin, int conf, int altf)
163163
}
164164
}
165165

166+
#if defined(CONFIG_SOC_SERIES_STM32L4X) && defined(GPIO_ASCR_ASC0)
167+
/*
168+
* For STM32L47xx/48xx, register ASCR should be configured to connect
169+
* analog switch of gpio lines to the ADC.
170+
*/
171+
if (mode == STM32_MODER_ANALOG_MODE) {
172+
LL_GPIO_EnablePinAnalogControl(gpio, pin_ll);
173+
}
174+
#endif
175+
166176
LL_GPIO_SetPinOutputType(gpio, pin_ll, otype >> STM32_OTYPER_SHIFT);
167177

168178
LL_GPIO_SetPinSpeed(gpio, pin_ll, ospeed >> STM32_OSPEEDR_SHIFT);

0 commit comments

Comments
 (0)