About GPIO
I am using a nucleo l4r5zi.
I would like to use the GPIOs on this board as inputs and get the value of those inputs from software.Specifically, I would like to use PG2 to accomplish this.
I have the following setup and am inputting 3.3v into PG2, but for some reason I cannot read the value of the input.
・Pin initilization
static void set_pin(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
__HAL_RCC_GPIOG_CLK_ENABLE();
HAL_PWREx_EnableVddIO2();
/*Configure GPIO pin : PG2 */
GPIO_InitStruct.Pin = GPIO_PIN_2;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct)
}・Read
HAL_GPIO_ReadPin(GPIOG, GPIO_PIN_2)Are there any settings that are missing?
