1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/stm32/periph_gpio: reset PU/PD for ADC channels

PU/PD configuration has to be `0b00` for analog outputs which is corresponds to the reset state. However, if the GPIO is not in reset state but was used digital input/output with any pull resistor, the PU/PD configuration has also to be reset to work as ADC channel.
This commit is contained in:
Gunar Schorcht 2023-05-10 08:35:17 +02:00
parent b93328d14b
commit ddb95e7648

View File

@ -186,8 +186,9 @@ void gpio_init_analog(gpio_t pin)
#else
periph_clk_en(AHB1, (RCC_AHB1ENR_GPIOAEN << _port_num(pin)));
#endif
/* set to analog mode */
/* set to analog mode, PUPD has to be 0b00 */
_port(pin)->MODER |= (0x3 << (2 * _pin_num(pin)));
_port(pin)->PUPDR &= ~(0x3 << (2 * _pin_num(pin)));
}
void gpio_irq_enable(gpio_t pin)