Skip to content

Instantly share code, notes, and snippets.

@2garryn
Created February 20, 2017 21:21
Show Gist options
  • Save 2garryn/f274d58cae2738f9283e5e78205b4e98 to your computer and use it in GitHub Desktop.
Save 2garryn/f274d58cae2738f9283e5e78205b4e98 to your computer and use it in GitHub Desktop.
void btn_init_port_pins(GPIO_TypeDef* GPIOx, uint32_t RCClocking, uint32_t pins) {
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCClocking, ENABLE);
GPIO_InitStructure.GPIO_Pin = pins;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(GPIOx, &GPIO_InitStructure);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment