Change the configuration of a GPIO pin in real time
I'm working on a project using an STM32H753XI. The board is using a GT911 touch controller for the LCD. To configure the I2C address I have to control the interrupt pin during reset either high or low. This means I need to configure the MCU pin connected to the interrupt output of the GT911 as an output during a reset and then change it to an external interrupt input right after the reset.
I used CubeMX to configure the pin as an external interrupt and then copied this resulting code from the GPIO init code:
/*Configure GPIO pin : PB8 */
GPIO_InitStruct.Pin = GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
I then used CubeMX to configure the pin to an output.
My touch interface init code holds the reset pin low and holds the interrupt pin low to select the address. After this is complete, I then use the code copied above to change the MCU pin connect to the the GT911 interrupt pin to an external interrupt. (hope this makes sense)
Best I can tell, this is not working as the pin, after reset, looks like there is bus contention. Is the real-time code I'm using sufficient to change the configuration of the GPIO pin?
Thanks
