I have an STM32F429l-DISC1 board.
I'm trying to read the value on pin PC11. This is the PORTC settings:
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);
GPIO_InitTypeDef GPIO_InitDef;
GPIO_InitDef.GPIO_Pin = GPIO_Pin_11;
GPIO_InitDef.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitDef.GPIO_OType = GPIO_OType_PP;
GPIO_InitDef.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC,&GPIO_InitDef);
And this is how i'm pulling the value:
uint8_t value = GPIO_ReadInputDataBit(GPIOC, 11);
When I connect the pin to GND i expect to obtain 0 as a value since it's a pullup... But I'm always getting a 1.
What I am doing wrong?
Thanks!
Change GPIO_ReadInputDataBit(GPIOC, 11);
to GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_11);
or GPIO_ReadInputDataBit(GPIOC, 1 << 11);
DO NOT USE SPL. It is long time DEAD.