void Key_GPIO_Config(void) //初始化按键的GPIO配置函数 {

GPIO_InitTypeDef GPIO_InitStructure; //定义GPIO配置结构体

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOE,ENABLE); //使能GPIOE时钟

GPIO_InitStructure.GPIO_Pin=GPIO_Pin_7; //配置GPIOE的第7个引脚

GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IPU; //将引脚配置为上拉输入模式

GPIO_Init(GPIOF,&GPIO_InitStructure); //将GPIO配置结构体应用到GPIOF引脚上

}

如下代码是配置按键的初始化函数说明其每行代码功能。直接写在题目空白处10分void Key_GPIO_ConfigvoidGPIO_InitTypeDef GPIO_InitStructure;RCC_APB2PeriphClockCmdRCC_APB2Periph_GPIOEENABLE; GPIO_InitStructureGPIO_Pin=GPIO_Pin_7;GPIO_InitStruct

原文地址: https://www.cveoy.top/t/topic/bC8l 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录