端口初始化
#include"stm32f10x.h"//PA15voidKEY_Init(void){GPIO_InitTypeDefGPIO_InitStructure;RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);//使能外设置时钟GPIO_InitStructure.GPIO_Pin=GPIO_Pin_15;//PA15上拉输入GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IPU;GPIO_Init(GPIOA,&GPIO_InitStructure);}
curton 2019-10-18 21:25