初中生
最后登录1970-1-1
在线时间 小时
注册时间2014-12-11
|
请问下面这段程序中 GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource0)这条语句是干什么用的,为啥会出下在这里,大神求解,麻烦说详细点
******************************************************************************
* @file bsp_exti.c
* @author fire
* @version V1.0
* @date 2013-xx-xx
* @brief I/OÏßÖD¶Ïó|óÃbsp
******************************************************************************
* @attention
*
* êμÑéƽì¨:ò°»e iSO STM32 ¿a·¢°å
* ÂÛì3 :http://www.firebbs.cn
* ìÔ±| :http://firestm32.taobao.com
*
******************************************************************************
*/
#include "bsp_exti.h"
/**
* @brief ÅäÖÃǶì×Ïòá¿ÖD¶Ï¿ØÖÆÆ÷NVIC
* @param ÎT
* @retval ÎT
*/
static void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
/* Configure one bit for preemption priority */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
/* ÅäÖÃÖD¶ÏÔ′ */
NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
/**
* @brief ÅäÖà PA0 ÎaÏßÖD¶Ï¿ú£¬2¢éèÖÃÖD¶ÏóÅÏ輶
* @param ÎT
* @retval ÎT
*/
void EXTI_PA0_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
EXTI_InitTypeDef EXTI_InitStructure;
/* config the extiline clock and AFIO clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO,ENABLE);
/* config the NVIC */
NVIC_Configuration();
/* EXTI line gpio config*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; // éÏà-êäèë
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* EXTI line mode config */
GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource0);
EXTI_InitStructure.EXTI_Line = EXTI_Line0;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; //ϽμÑØÖD¶Ï
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
}
|
|