代码如下:- #define KEY_ROW1_0 GPIO_ResetBits(GPIOB,GPIO_Pin_4)
- #define KEY_ROW1_1 GPIO_SetBits(GPIOB,GPIO_Pin_4)
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
- /* Disable the JTAG inte**ce and enable the SWJ inte**ce */
- GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
- GPIO_Init(GPIOB,&GPIO_InitStructure);
- KEY_ROW1_1; //PB4电压3.3V
- KEY_ROW1_0; //PB4电压还是3.3V 没反应
- KEY_ROW1_1;
|