void Key_GPIO_Config(void) { // 定义GPIO初始化结构体 GPIO_InitTypeDef GPIO_InitStructure;

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

// 配置GPIOE的Pin7为输入模式,上拉输入
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; 
GPIO_Init(GPIOF, &GPIO_InitStructure);

}

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

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

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