F4的PA14如何做普通输入口

2019-07-20 11:16发布

直接初始化无效,应该是JTCK没有失能,求指导
[mw_shl_code=c,true]        GPIO_InitTypeDef GPIO_InitStructure;
        EXTI_InitTypeDef EXTI_InitStructure;
        NVIC_InitTypeDef NVIC_InitStructure;
       
        RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE);
        RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);//RCC_APB2Periph_AFIO
////////////////GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable , ENABLE);  F4没这句话
        GPIO_InitStructure.GPIO_Pin  = GPIO_PIN_14;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;                 
        GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(GPIOA, &GPIO_InitStructure);

        SYSCFG_EXTILineConfig(WIEGAND1_PortSource,EXTI_PinSource14);
        EXTI_InitStructure.EXTI_Line        = EXTI_Line14;
  EXTI_InitStructure.EXTI_Mode         = EXTI_Mode_Interrupt;       
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure);       

        NVIC_InitStructure.NVIC_IRQChannel         = EXTI15_10_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x01;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority         = 0x02;
  NVIC_InitStructure.NVIC_IRQChannelCmd         = ENABLE;
  NVIC_Init(&NVIC_InitStructure); [/mw_shl_code]

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。