当前位置: 首页>>代码示例>>C++>>正文


C++ EXTI_Init函数代码示例

本文整理汇总了C++中EXTI_Init函数的典型用法代码示例。如果您正苦于以下问题:C++ EXTI_Init函数的具体用法?C++ EXTI_Init怎么用?C++ EXTI_Init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了EXTI_Init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HAL_Interrupts_Detach

void HAL_Interrupts_Detach(uint16_t pin)
{
  //Map the Spark Core pin to the appropriate pin on the STM32
  STM32_Pin_Info* PIN_MAP = HAL_Pin_Map();
  uint16_t gpio_pin = PIN_MAP[pin].gpio_pin;
  uint8_t GPIO_PinSource = PIN_MAP[pin].gpio_pin_source;

  //Clear the pending interrupt flag for that interrupt pin
  EXTI_ClearITPendingBit(gpio_pin);

  //EXTI structure to init EXT
  EXTI_InitTypeDef EXTI_InitStructure = {0};

  //Select the appropriate EXTI line
  EXTI_InitStructure.EXTI_Line = gpio_pin;
  //disable that EXTI line
  EXTI_InitStructure.EXTI_LineCmd = DISABLE;
  //send values to registers
  EXTI_Init(&EXTI_InitStructure);

  //unregister the user's handler
  exti_channels[GPIO_PinSource].fn = NULL;
  exti_channels[GPIO_PinSource].data = NULL;
}
开发者ID:Babbleshack,项目名称:firmware,代码行数:24,代码来源:interrupts_hal.c

示例2: EXTI_PC13_Config

 /**
  * @brief  配置 PC13 为线中断口,并设置中断优先级
  * @param  无
  * @retval 无
  */
void EXTI_PC13_Config(void)
{
	GPIO_InitTypeDef GPIO_InitStructure; 
	EXTI_InitTypeDef EXTI_InitStructure;

	/* config the extiline(PC13) clock and AFIO clock */
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC | RCC_APB2Periph_AFIO,ENABLE);
												
	/* config the NVIC(PC13) */
	NVIC_Configuration();

	/* EXTI line gpio config(PC13) */	
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;       
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;	 // 上拉输入
  GPIO_Init(GPIOC, &GPIO_InitStructure);

	/* EXTI line(PC13) mode config */
  GPIO_EXTILineConfig(GPIO_PortSourceGPIOC, GPIO_PinSource13); 
  EXTI_InitStructure.EXTI_Line = EXTI_Line13;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; //下降沿中断
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure); 
}
开发者ID:ChijunShen,项目名称:wildfire_stm32_iso,代码行数:29,代码来源:bsp_exti.c

示例3: EXTI_Init

void CRF::SetIRQ(FunctionalState state)
{
	if (m_IRQ_BB)
	{
		EXTI_InitTypeDef EXTI_InitStructure;
		EXTI_InitStructure.EXTI_Line = m_IRQ;
		EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
		EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
		EXTI_InitStructure.EXTI_LineCmd = state;
		EXTI_Init(&EXTI_InitStructure);
		GPIO_EXTILineConfig(GPIO_PORT_NUM(m_IRQ_GPIO), GPIO_PIN_NUM_FROM_BB(m_IRQ_BB));
		
		// Clear pending interrupt before enabling it.
		EXTI_ClearITPendingBit(m_IRQ);
    		NVIC_ClearPendingIRQ(m_IRQn);

		NVIC_InitTypeDef NVIC_InitStructure;
		NVIC_InitStructure.NVIC_IRQChannel = m_IRQn;
		NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
		NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
		NVIC_InitStructure.NVIC_IRQChannelCmd = state;
		NVIC_Init(&NVIC_InitStructure);
	}
}
开发者ID:houguozhi,项目名称:HS6206_CP_GS_MCU_FM,代码行数:24,代码来源:rf.cpp

示例4: EnExtInter

void EnExtInter() {
	//EXTI_X must be equal to pin_Yx.. you can choose Y as ABCD but NOT the X number pin0(abcd)->Exti0->irq0

	//GPIO_EXTILineConfig(GPIO_PortSourceGPIOA , GPIO_PinSource0);

     EXTI_InitTypeDef EXTI_InitStructure;

     /* Configure EXTI Line0 */
     EXTI_InitStructure.EXTI_Line = EXTI_Line0;
     EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
     EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
     EXTI_InitStructure.EXTI_LineCmd = ENABLE;
     EXTI_Init(&EXTI_InitStructure);

     /* Enable and set EXTI Line0 Interrupt to the lowest priority */
     NVIC_InitTypeDef NVIC_InitStructure;
     NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
     NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x01;
     NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x01;
     NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
     NVIC_Init(&NVIC_InitStructure);


}
开发者ID:Broentech,项目名称:Vri_fog_device,代码行数:24,代码来源:interHandler.c

示例5: hcsr04_init

void hcsr04_init(const sonarHardware_t *initialSonarHardware)
{
    gpio_config_t gpio;
    EXTI_InitTypeDef EXTIInit;

    sonarHardware = initialSonarHardware;

    // enable AFIO for EXTI support
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);

    // tp - trigger pin
    gpio.pin = sonarHardware->trigger_pin;
    gpio.mode = Mode_Out_PP;
    gpio.speed = Speed_2MHz;
    gpioInit(GPIOB, &gpio);

    // ep - echo pin
    gpio.pin = sonarHardware->echo_pin;
    gpio.mode = Mode_IN_FLOATING;
    gpioInit(GPIOB, &gpio);

    // setup external interrupt on echo pin
    gpioExtiLineConfig(GPIO_PortSourceGPIOB, sonarHardware->exti_pin_source);

    EXTI_ClearITPendingBit(sonarHardware->exti_line);

    EXTIInit.EXTI_Line = sonarHardware->exti_line;
    EXTIInit.EXTI_Mode = EXTI_Mode_Interrupt;
    EXTIInit.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
    EXTIInit.EXTI_LineCmd = ENABLE;
    EXTI_Init(&EXTIInit);

    NVIC_EnableIRQ(sonarHardware->exti_irqn);

    last_measurement = millis() - 60; // force 1st measurement in hcsr04_get_distance()
}
开发者ID:AhLeeYong,项目名称:cleanflight,代码行数:36,代码来源:sonar_hcsr04.c

示例6: VSYNC_EXTI_Configuration

/**
 *  @name	VSYNC_EXTI_Configuration
 *  @brief	配置PB7为外部中断引脚
 *  @param  None        
 *  @return None
 *  @notice
	                ___                            ___
	  VSYNC:     __|   |__________________________|   |__     
	 
 */
static void VSYNC_EXTI_Configuration(void)
{
	CKCU_PeripClockConfig_TypeDef CKCUClock = {{0}};
	EXTI_InitTypeDef EXTI_InitStruct;
	
	/* Enable PB & AFIO & EXTI */
	CKCUClock.Bit.PB         = 1;
	CKCUClock.Bit.AFIO 		 = 1;
	CKCUClock.Bit.EXTI 		 = 1;
	CKCU_PeripClockConfig(CKCUClock, ENABLE);

	/* Config EXTI channel 7 */
	EXTI_InitStruct.EXTI_Channel = EXTI_CHANNEL_7;
	EXTI_InitStruct.EXTI_Debounce = EXTI_DEBOUNCE_DISABLE;
	EXTI_InitStruct.EXTI_DebounceCnt = 0;
	EXTI_InitStruct.EXTI_IntType = EXTI_NEGATIVE_EDGE;
	EXTI_Init(&EXTI_InitStruct);
	
	/* Select Port as EXTI Trigger Source */
	AFIO_EXTISourceConfig(AFIO_EXTI_CH_7, AFIO_ESS_PB);
	
	/* Enable EXTI line 7 Interrupt                                                                          */
	EXTI_IntConfig(EXTI_CHANNEL_7, ENABLE);
}
开发者ID:gaunthan,项目名称:SmartHelmet,代码行数:34,代码来源:ov7670.c

示例7: eth_nvic

int eth_nvic(struct driver * driver)
{
	EXTI_InitTypeDef EXTI_InitStructure;
  NVIC_InitTypeDef NVIC_InitStructure;
	
	/* Connect EXTI Line to INT Pin */
  SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOH, EXTI_PinSource6);
	
	/* Configure EXTI line */
  EXTI_InitStructure.EXTI_Line = EXTI_Line6;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure);

  /* Enable and set the EXTI interrupt to the highest priority */
  NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 4;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);
	
	return 0;
}
开发者ID:zhumj1991,项目名称:general-bsp,代码行数:24,代码来源:eth.c

示例8: EXTILine13_Config

/**
  * @brief  Configures EXTI Line15 (connected to PG15 pin) in interrupt mode
  * @param  None
  * @retval None
  */
static void EXTILine13_Config(void)
{
  EXTI_InitTypeDef   EXTI_InitStructure;
  GPIO_InitTypeDef   GPIO_InitStructure;
  NVIC_InitTypeDef   NVIC_InitStructure;

  /* Enable GPIOC clock */
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);
  
  /* Enable SYSCFG clock */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
  
  /* Configure PC13 pin as input floating */
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
  GPIO_Init(GPIOC, &GPIO_InitStructure);

  /* Connect EXTI Line15 to PC13 pin */
  SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOC, EXTI_PinSource13);

  /* Configure EXTI Line13 */
  EXTI_InitStructure.EXTI_Line = EXTI_Line13;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure);

  /* Enable and set EXTI15_10 Interrupt to the lowest priority */
  NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

  NVIC_Init(&NVIC_InitStructure);
}
开发者ID:iGaryGu,项目名称:Painter,代码行数:41,代码来源:main.c

示例9: EXTI_PC13_Config

void EXTI_PC13_Config(void)
{
	GPIO_InitTypeDef GPIO_InitStructure;
	EXTI_InitTypeDef EXTI_InitStructure;
	
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC|RCC_APB2Periph_AFIO,ENABLE);
	
	NVIC_Configuration();
	
	
	GPIO_InitStructure.GPIO_Pin=GPIO_Pin_13;
	
	GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IPU;
	GPIO_Init(GPIOC,&GPIO_InitStructure);
	
	GPIO_EXTILineConfig(GPIO_PortSourceGPIOC,GPIO_PinSource13);
	EXTI_InitStructure.EXTI_Line=EXTI_Line13;
	EXTI_InitStructure.EXTI_Mode=EXTI_Mode_Interrupt;
	EXTI_InitStructure.EXTI_Trigger=EXTI_Trigger_Falling;
	
	EXTI_InitStructure.EXTI_LineCmd =ENABLE;
	EXTI_Init(&EXTI_InitStructure);
	
}
开发者ID:xyzzhangfan,项目名称:aircondition-control,代码行数:24,代码来源:exit.c

示例10: EXTILine_Config

/**
  * @brief  Configures EXTI Line0 (connected to PA0 pin) in interrupt mode
  * @param  None
  * @retval None
  */
static void EXTILine_Config(void)
{
  GPIO_InitTypeDef   GPIO_InitStructure;
  NVIC_InitTypeDef   NVIC_InitStructure;
  EXTI_InitTypeDef   EXTI_InitStructure;
	
  /* Enable GPIOA clock */
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
  /* Enable SYSCFG clock */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
	
  /* Configure PE0 and PE1 pins as input floating */
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
  GPIO_Init(GPIOA, &GPIO_InitStructure);

  /* Connect EXTI Line to PE1 pins */
  SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource0);

  /* Configure EXTI Line1 */
  EXTI_InitStructure.EXTI_Line = EXTI_Line0;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;  
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure);

  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
  
  /* Enable and set EXTI Line0 Interrupt to the lowest priority */
  NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);
}
开发者ID:emanuelribeiro,项目名称:projeto1,代码行数:41,代码来源:waveplayer.c

示例11: SysTick_Handler

void SysTick_Handler(void)
{
	if(dht22_data->metering_stage == DHT22_done)
		return;
	if(dht22_data->metering_stage == DHT22_sendStrobe0) {
		// 3.1
		GPIO_initStruct.GPIO_Pin = DHT22_PIN;
		GPIO_initStruct.GPIO_Mode = GPIO_Mode_IN;
		GPIO_Init(DHT22_PORT, &GPIO_initStruct);
		// 3.2
		dht22_data->metering_stage = DHT22_waitRisingEdge;
		SysTick_Config(dht22_data->timeout);
		// 3.3
		SYSCFG_EXTILineConfig(DHT22_EXTI_PORT, DHT22_PIN_NUM);
		EXTI_initStruct.EXTI_Line = DHT22_EXTI_LINE;
		EXTI_initStruct.EXTI_Mode = EXTI_Mode_Interrupt;
		EXTI_initStruct.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
		EXTI_initStruct.EXTI_LineCmd = ENABLE;
		EXTI_Init(&EXTI_initStruct);

		NVIC_initStruct.NVIC_IRQChannel = EXTI4_15_IRQn;
		NVIC_initStruct.NVIC_IRQChannelPriority = 0x00;
		NVIC_initStruct.NVIC_IRQChannelCmd = ENABLE;
		NVIC_Init(&NVIC_initStruct);
	}
	else {
		// 3.4
		SysTick->CTRL &= ~(SysTick_CTRL_TICKINT_Msk | SysTick_CTRL_ENABLE_Msk);
		NVIC_initStruct.NVIC_IRQChannel = EXTI4_15_IRQn;
		NVIC_initStruct.NVIC_IRQChannelPriority = 0x00;
		NVIC_initStruct.NVIC_IRQChannelCmd = DISABLE;
		NVIC_Init(&NVIC_initStruct);
		dht22_data->result = DHT22_ERR_TIMEOUT;
		dht22_data->done_cb(dht22_data);
	}
}
开发者ID:andrey-perepelitsyn,项目名称:stm32,代码行数:36,代码来源:dht22.c

示例12: xxxx

void xxxx(void)
{
	GPIO_InitTypeDef   GPIO_InitStructure;
	EXTI_InitTypeDef EXTI_InitStructure;
	NVIC_InitTypeDef NVIC_InitStructure;

	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
    GPIO_Init(GPIOC, &GPIO_InitStructure);

	GPIO_EXTILineConfig(GPIO_PortSourceGPIOC, GPIO_PinSource0);
	EXTI_InitStructure.EXTI_Line = EXTI_Line0;
	EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
	EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
	EXTI_InitStructure.EXTI_LineCmd = ENABLE;
	EXTI_Init(&EXTI_InitStructure);

	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);
}
开发者ID:294250581,项目名称:TMCS,代码行数:24,代码来源:main.c

示例13: Gpio_Int_Init_adns9800

void Gpio_Int_Init_adns9800(void)
{
  
  EXTI_InitTypeDef   EXTI_InitStructure;
  GPIO_InitTypeDef   GPIO_InitStructure;
  NVIC_InitTypeDef   NVIC_InitStructure;
  
  /* Enable GPIOA clock */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
  
  /* Configure PA.00 pin as input floating */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
  //GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;
  GPIO_Init(GPIOA, &GPIO_InitStructure);
  
  /* Enable AFIO clock */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
  
  /* Connect EXTI0 Line to PA.00 pin */
  GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource0);
  
  /* Configure EXTI0 line */
  EXTI_InitStructure.EXTI_Line = EXTI_Line0;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;  
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure);
  
  /* Enable and set EXTI0 Interrupt to the lowest priority */
  NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);
}
开发者ID:li77leprince,项目名称:Laparoscopic,代码行数:36,代码来源:adns9200.c

示例14: Camera_NVIC_Configuration

/****************************************************************************
* 名    称:void NVIC_Configuration(void)
* 功    能:中断源配置
* 入口参数:无
* 出口参数:无
* 说    明:
* 调用方法:无
****************************************************************************/
void Camera_NVIC_Configuration(void)
{
    NVIC_InitTypeDef NVIC_InitStructure;
    EXTI_InitTypeDef EXTI_InitStructure;
    /* Configure one bit for preemption priority */
    NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);

    NVIC_InitStructure.NVIC_IRQChannel = EXTI4_IRQn ;				 //外部中断4
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;	     //抢占优先级 0
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;			 //子优先级0
    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;				 //使能
    NVIC_Init(&NVIC_InitStructure);

    //用于配置AFIO外部中断配置寄存器AFIO_EXTICR1,用于选择EXTI4外部中断的输入源是PE4。
    GPIO_EXTILineConfig(GPIO_PortSourceGPIOE, GPIO_PinSource4);     //外部中断配置AFIO--ETXI4

    EXTI_InitStructure.EXTI_Line = EXTI_Line4;					  //PE4 作为摄像头帧同步检测 检测一帧FIFO接收完成
    EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;			  //中断模式
    EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;		  //下降沿触发
    EXTI_InitStructure.EXTI_LineCmd = ENABLE;
    EXTI_Init(&EXTI_InitStructure);


}
开发者ID:wareash,项目名称:stm32-camera,代码行数:32,代码来源:OV7670.c

示例15: EXTI_NVIC_Config_PushButton

/*
 * Function: EXTI_NVIC_Config_PushButton
 * ----------------------------
 * Configure EXTI and NVIC pin PA0 line0 for push button interrupts
 *   Returns: void
 *
 *   @param: none
 *   returns: none
 */
void EXTI_NVIC_Config_PushButton(void)
{
	GPIO_InitTypeDef GPIO_MEM_Init_struct;
	EXTI_InitTypeDef EXTI_MEM_struct;
	NVIC_InitTypeDef NVIC_MEM_struct;
	
	RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
	// Enable SYSCFG clock 
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
	
	GPIO_StructInit(&GPIO_MEM_Init_struct);
	
	GPIO_MEM_Init_struct.GPIO_Mode = GPIO_Mode_IN;
	GPIO_MEM_Init_struct.GPIO_Pin = GPIO_Pin_0;
	GPIO_MEM_Init_struct.GPIO_PuPd = GPIO_PuPd_NOPULL;
  
	GPIO_Init(GPIOA, &GPIO_MEM_Init_struct);
	
	SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource0);
	
	EXTI_MEM_struct.EXTI_Line = EXTI_Line0;
  EXTI_MEM_struct.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_MEM_struct.EXTI_Trigger = EXTI_Trigger_Rising;  
  EXTI_MEM_struct.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_MEM_struct);

  /* Enable and set EXTI Line0 Interrupt */ 
  NVIC_MEM_struct.NVIC_IRQChannel = EXTI0_IRQn;
  NVIC_MEM_struct.NVIC_IRQChannelPreemptionPriority = 0x01;
  NVIC_MEM_struct.NVIC_IRQChannelSubPriority = 0x02; // set priority to 2, accelerometer data ready interrupts gets priority of 1
  NVIC_MEM_struct.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_MEM_struct);
	
	return;

}
开发者ID:YangZhou91,项目名称:MicroP-Project,代码行数:45,代码来源:main.c


注:本文中的EXTI_Init函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。