How can I dynamically change the GPIO configuration of stm32f072
Hi.
I wonder if I can dynamically change the GPIO configuration of stm32f072.(that is, input to output or output to input)
Regards.
Hi.
I wonder if I can dynamically change the GPIO configuration of stm32f072.(that is, input to output or output to input)
Regards.
Hello!
Yes you can change on the fly the mode of GPIO pin.
by change GPIOx_MODER register.
You can use SPL function, GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)
HAL function, HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init)
Directly, GPIOx->MODER &= ~ y ; GPIOx->MODER |=z; (zeroize first and write after) Read Ref MAnual about MODER Reg
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.