where 3 is 0b11 for Analog Mode as given by GPIOx_MODER description in the GPIO chapter of RM; 5 is for PA5; 2 is because there are 2 bits per pin in GPIOx_MODER.
My question is what if I want to switch only a particular bit to Analog mode without switching whole GPIO PORT into Analog mode before entering to Stop2mode..
> My question is what if I want to switch only a particular bit to Analog mode without switching whole GPIO PORT into Analog mode before entering to Stop2mode..
Yes, that is the question I answered.
Set the bits associated with that pin to analog mode and leave the bits associated with other pins unmodified.
You can also use HAL_GPIO_Init to do this.
"If you feel a post has answered your question, please click ""Accept as Solution""."
where 3 is 0b11 for Analog Mode as given by GPIOx_MODER description in the GPIO chapter of RM; 5 is for PA5; 2 is because there are 2 bits per pin in GPIOx_MODER.