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


C++ EXTI_ClearITPendingBit函数代码示例

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


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

示例1: EXTI9_5_IRQHandler

void EXTI9_5_IRQHandler(void)
{
    process_deca_irq();
    /* Clear EXTI Line 8 Pending Bit */
    EXTI_ClearITPendingBit(DECAIRQ_EXTI);
}
开发者ID:clementfumey,项目名称:sds-twr,代码行数:6,代码来源:stm32f10x_it.c

示例2: EXTI0_IRQHandler

// button EXTernal Interrupt - change LED blink delay
void EXTI0_IRQHandler(){
	if(LED_delay > 50) LED_delay -= 50;
	else LED_delay = 1000;
	EXTI_ClearITPendingBit(EXTI_Line0);
}
开发者ID:eddyem,项目名称:STM32F407-control,代码行数:6,代码来源:interrupts.c

示例3: EXTI4_IRQHandler

void EXTI4_IRQHandler(void) {
    if (EXTI_GetITStatus(EXTI_Line4) == SET) {
        jshPushIOWatchEvent(EV_EXTI4);
        EXTI_ClearITPendingBit(EXTI_Line4);
    }
}
开发者ID:RepRapThailand,项目名称:Espruino,代码行数:6,代码来源:stm32_it.c

示例4: USB_OTG_BSP_Init


//.........这里部分代码省略.........
                         RCC_AHB1Periph_OTG_HS_ULPI, ENABLE) ;    
   
  #else
  
   #ifdef USE_I2C_PHY    
  RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_GPIOB , ENABLE);  
  /* Configure RESET INTN SCL SDA (Phy/I2C) Pins */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | 
    GPIO_Pin_1 | 
      GPIO_Pin_10 | 
        GPIO_Pin_11;
  
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
  GPIO_Init(GPIOB, &GPIO_InitStructure);  
  
  GPIO_PinAFConfig(GPIOB,GPIO_PinSource0,GPIO_AF_OTG2_FS) ; 
  GPIO_PinAFConfig(GPIOB,GPIO_PinSource1,GPIO_AF_OTG2_FS) ; 
  GPIO_PinAFConfig(GPIOB,GPIO_PinSource10,GPIO_AF_OTG2_FS) ; 
  GPIO_PinAFConfig(GPIOB,GPIO_PinSource11,GPIO_AF_OTG2_FS);
  RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_OTG_HS, ENABLE) ;  
  
   #else

  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB , ENABLE);
  
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12  | 
    GPIO_Pin_13 |
      GPIO_Pin_14 | 
        GPIO_Pin_15;
  
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
  GPIO_Init(GPIOB, &GPIO_InitStructure);  
  
  GPIO_PinAFConfig(GPIOB,GPIO_PinSource12, GPIO_AF_OTG2_FS) ; 
  GPIO_PinAFConfig(GPIOB,GPIO_PinSource13,GPIO_AF_OTG2_FS) ; 
  GPIO_PinAFConfig(GPIOB,GPIO_PinSource14,GPIO_AF_OTG2_FS) ; 
  GPIO_PinAFConfig(GPIOB,GPIO_PinSource15,GPIO_AF_OTG2_FS) ;
  RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_OTG_HS, ENABLE) ;  
   #endif    
  #endif
 #endif //USB_OTG_HS
#endif //USE_STM322xG_EVAL


  /* enable the PWR clock */
  RCC_APB1PeriphResetCmd(RCC_APB1Periph_PWR, ENABLE);


#ifdef USB_OTG_FS_LOW_PWR_MGMT_SUPPORT
  /* Configure the Key button in EXTI mode */
  STM32F4_Discovery_PBInit(BUTTON_USER, BUTTON_MODE_EXTI);

  EXTI_ClearITPendingBit(EXTI_Line18);

  EXTI_InitStructure.EXTI_Line = EXTI_Line18;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure);

  EXTI_ClearITPendingBit(EXTI_Line18);

  NVIC_InitStructure.NVIC_IRQChannel = OTG_FS_WKUP_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);

  EXTI_ClearITPendingBit(EXTI_Line18);
#endif

#ifdef USB_OTG_HS_LOW_PWR_MGMT_SUPPORT
  /* Configure the Key button in EXTI mode */
  STM32F4_Discovery_PBInit(BUTTON_USER, BUTTON_MODE_EXTI);

  EXTI_ClearITPendingBit(EXTI_Line20);

  EXTI_InitStructure.EXTI_Line = EXTI_Line20;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure);

  EXTI_ClearITPendingBit(EXTI_Line20);

  NVIC_InitStructure.NVIC_IRQChannel = OTG_HS_WKUP_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);

  EXTI_ClearITPendingBit(EXTI_Line20);
#endif

  EXTI_ClearITPendingBit(USER_BUTTON_EXTI_LINE);


}
开发者ID:hplaneti,项目名称:PTM_wysw,代码行数:101,代码来源:usb_bsp.c

示例5: StopMode_Measure

/**
  * @brief  This function configures the system to enter Stop mode with RTC 
  *         clocked by LSI for current consumption measurement purpose.
  *         STOP Mode with RTC clocked by LSI
  *         =====================================   
  *           - RTC Clocked by LSI
  *           - Regulator in LP mode
  *           - HSI, HSE OFF and LSI OFF if not used as RTC Clock source
  *           - No IWDG
  *           - FLASH in deep power down mode
  *           - Automatic Wakeup using RTC clocked by LSI (~5s)
  * @param  None
  * @retval None
  */
void StopMode_Measure(void)
{
  __IO uint32_t index = 0;
  GPIO_InitTypeDef GPIO_InitStructure;
  NVIC_InitTypeDef  NVIC_InitStructure;
  EXTI_InitTypeDef  EXTI_InitStructure;
  RTC_InitTypeDef   RTC_InitStructure;
  RTC_TimeTypeDef   RTC_TimeStructure;
  RTC_AlarmTypeDef  RTC_AlarmStructure;
  
  /* Allow access to RTC */
  PWR_BackupAccessCmd(ENABLE);

/* The RTC Clock may varies due to LSI frequency dispersion. */   
  /* Enable the LSI OSC */ 
  RCC_LSICmd(ENABLE);

  /* Wait till LSI is ready */  
  while(RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET)
  {
  }

  /* Select the RTC Clock Source */
  RCC_RTCCLKConfig(RCC_RTCCLKSource_LSI);

  /* Enable the RTC Clock */
  RCC_RTCCLKCmd(ENABLE);

  /* Wait for RTC APB registers synchronisation */
  RTC_WaitForSynchro();

  /* Configure all GPIO as analog to reduce current consumption on non used IOs */
  /* Enable GPIOs clock */
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC |
                         RCC_AHBPeriph_GPIOD | RCC_AHBPeriph_GPIOF , ENABLE);

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
  GPIO_Init(GPIOC, &GPIO_InitStructure);
  GPIO_Init(GPIOD, &GPIO_InitStructure);
  GPIO_Init(GPIOF, &GPIO_InitStructure);
  GPIO_Init(GPIOA, &GPIO_InitStructure);
  GPIO_Init(GPIOB, &GPIO_InitStructure);

  /* Disable GPIOs clock */
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA |RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC |
                         RCC_AHBPeriph_GPIOD | RCC_AHBPeriph_GPIOF, DISABLE);
 
  RTC_InitStructure.RTC_HourFormat = RTC_HourFormat_24;
  RTC_InitStructure.RTC_AsynchPrediv = 0x7F;
  RTC_InitStructure.RTC_SynchPrediv = 0x0138;
  
  if (RTC_Init(&RTC_InitStructure) == ERROR)
  {
    while(1);
  }
    
  /* EXTI configuration */
  EXTI_ClearITPendingBit(EXTI_Line17);
  EXTI_InitStructure.EXTI_Line = EXTI_Line17;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure);
  
  /* NVIC configuration */
  NVIC_InitStructure.NVIC_IRQChannel = RTC_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);
  
  /* Set the alarm X+5s */
  RTC_AlarmStructure.RTC_AlarmTime.RTC_H12     = RTC_H12_AM;
  RTC_AlarmStructure.RTC_AlarmTime.RTC_Hours   = 0x01;
  RTC_AlarmStructure.RTC_AlarmTime.RTC_Minutes = 0x00;
  RTC_AlarmStructure.RTC_AlarmTime.RTC_Seconds = 0x05;
  RTC_AlarmStructure.RTC_AlarmDateWeekDay = 0x31;
  RTC_AlarmStructure.RTC_AlarmDateWeekDaySel = RTC_AlarmDateWeekDaySel_Date;
  RTC_AlarmStructure.RTC_AlarmMask = RTC_AlarmMask_DateWeekDay;
  RTC_SetAlarm(RTC_Format_BCD, RTC_Alarm_A, &RTC_AlarmStructure);
  
  /* Enable the alarm */
  RTC_AlarmCmd(RTC_Alarm_A, ENABLE);
  
//.........这里部分代码省略.........
开发者ID:Amna2013,项目名称:stm32-test,代码行数:101,代码来源:stm32f0xx_lp_modes.c

示例6: main

/**
* @brief  System main function.
* @param  None
* @retval None
*/
void main (void)
{
  SDK_SYSTEM_CONFIG();

#ifdef USE_VCOM
#ifdef STM8L
  SdkEvalComInit(115200,USART_WordLength_8b,USART_StopBits_1,USART_Parity_No,(USART_Mode_TypeDef)(USART_Mode_Rx | USART_Mode_Tx));
#elif SDK
  /* VC config */
  SdkEvalVCInit();
  while(bDeviceState != CONFIGURED);
#endif
#endif

  /* Spirit ON */
  SpiritEnterShutdown();
  SpiritExitShutdown();
  SpiritManagementWaExtraCurrent();
  
#ifdef STM8L
  /* Manually set the XTAL_FREQUENCY */
  SpiritRadioSetXtalFrequency(XTAL_FREQUENCY);    
  /* Initialize the frequency offset variable to compensate XTAL offset */
  xRadioInit.lFrequencyBase = xRadioInit.lFrequencyBase + FREQUENCY_OFFSET;
  /* Initialize the signals to drive the range extender application board */
  RANGE_EXT_INIT(RANGE_TYPE);
#elif SDK
  SpiritManagementIdentificationRFBoard();

  /* if the board has eeprom, we can compensate the offset calling SpiritManagementGetOffset
  (if eeprom is not present this fcn will return 0) */
  xRadioInit.lFrequencyBase = xRadioInit.lFrequencyBase + SpiritManagementGetOffset();
  
  /* Initialize the signals to drive the range extender application board */
  SpiritManagementRangeExtInit();  
#endif

  /* Spirit IRQ config */
  SpiritGpioInit(&xGpioIRQ);

  /* Spirit Radio config */
  SpiritRadioInit(&xRadioInit);

  /* Spirit Radio set power */
  SpiritRadioSetPALeveldBm(0,POWER_DBM);
  SpiritRadioSetPALevelMaxIndex(0);
  
  /* Spirit Packet config */
  SpiritPktStackInit(&xStackInit);
  //SpiritPktStackAddressesInit(&xAddressInit);
  SpiritPktStackLlpInit(&xStackLLPInit);

  /* Spirit IRQs enable */
  SpiritIrqDeInit(&xIrqStatus);
  SpiritIrq(RX_DATA_DISC,S_ENABLE);
  SpiritIrq(RX_DATA_READY,S_ENABLE);
  SpiritIrq(TX_DATA_SENT , S_ENABLE);

  EXTI_ClearITPendingBit(M2S_GPIO_3_EXTI_LINE);
  SdkEvalM2SGpioInit(M2S_GPIO_3,M2S_MODE_EXTI_IN);

  /* enable SQI check */
  SpiritQiSetSqiThreshold(SQI_TH_0);
  SpiritQiSqiCheck(S_ENABLE);

  /* rx timeout config */
  SpiritTimerSetRxTimeoutMs(1000.0);
  //SET_INFINITE_RX_TIMEOUT();
  SpiritTimerSetRxTimeoutStopCondition(SQI_ABOVE_THRESHOLD);

  /* IRQ registers blanking */
  SpiritIrqClearStatus();

#ifdef PIGGYBACKING
  /* payload length config */
  SpiritPktStackSetPayloadLength(20);
  /* write piggybacking data */
  SpiritSpiWriteLinearFifo(20, vectcTxBuff);
#endif

#ifdef STM8L
  enableInterrupts();
#elif SDK
  SdkEvalM2SGpioInterruptCmd(M2S_GPIO_3,0x0A,0x0A,ENABLE);
#endif
  
  /* RX command */
  SpiritCmdStrobeRx();

  while (1){      
  }

}
开发者ID:nidhal55,项目名称:IOT-WPAN-spirit1--meter-router-concentrator--based-on-random-walk-routing,代码行数:98,代码来源:SDK_StackLlp_B.c

示例7: main

/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
  this is done through SystemInit() function which is called from startup
  file (startup_stm32f30x.s) before to branch to application main.
  To reconfigure the default setting of SystemInit() function, refer to
  system_stm32f30x.c file
  */ 
  
  /* LEDs Init */
  STM_EVAL_LEDInit(LED3);
  STM_EVAL_LEDInit(LED4);
  STM_EVAL_LEDInit(LED5);
  STM_EVAL_LEDInit(LED6);
  STM_EVAL_LEDInit(LED7);
  STM_EVAL_LEDInit(LED8);
  STM_EVAL_LEDInit(LED9);
  STM_EVAL_LEDInit(LED10);
  
  /* Enable PWR APB1 Clock */
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
  
  /* Allow access to Backup */
  PWR_BackupAccessCmd(ENABLE);
  
  /* Reset RTC Domain */
  RCC_BackupResetCmd(ENABLE);
  RCC_BackupResetCmd(DISABLE);
  
  /* Allow access to RTC */
  PWR_BackupAccessCmd(ENABLE);
  
  /* The RTC Clock may varies due to LSI frequency dispersion */   
  /* Enable the LSI OSC */ 
  RCC_LSICmd(ENABLE);
  
  /* Wait till LSI is ready */  
  while(RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET)
  {
  }
  
  /* Select the RTC Clock Source */
  RCC_RTCCLKConfig(RCC_RTCCLKSource_LSI);
  
  /* Enable the RTC Clock */
  RCC_RTCCLKCmd(ENABLE);
  
  /* Wait for RTC APB registers synchronisation */
  RTC_WaitForSynchro();

  /* RTC prescaler configuration */
  RTC_InitStructure.RTC_HourFormat = RTC_HourFormat_24;
  RTC_InitStructure.RTC_AsynchPrediv = 88;
  RTC_InitStructure.RTC_SynchPrediv = 470;
  RTC_Init(&RTC_InitStructure);
  
  /* Set the alarm 01h:00min:04s */
  RTC_AlarmStructure.RTC_AlarmTime.RTC_H12     = RTC_H12_AM;
  RTC_AlarmStructure.RTC_AlarmTime.RTC_Hours   = 0x01;
  RTC_AlarmStructure.RTC_AlarmTime.RTC_Minutes = 0x00;
  RTC_AlarmStructure.RTC_AlarmTime.RTC_Seconds = 0x04;
  RTC_AlarmStructure.RTC_AlarmDateWeekDay = 0x31;
  RTC_AlarmStructure.RTC_AlarmDateWeekDaySel = RTC_AlarmDateWeekDaySel_Date;
  /* Alarm mask hour, min and second:default Alarm generation each 1s */
  RTC_AlarmStructure.RTC_AlarmMask = RTC_AlarmMask_All; 
  RTC_SetAlarm(RTC_Format_BCD, RTC_Alarm_A, &RTC_AlarmStructure);
    
  /* Enable RTC Alarm A Interrupt */
  RTC_ITConfig(RTC_IT_ALRA, ENABLE);
  
  /* Enable the alarm */
  RTC_AlarmCmd(RTC_Alarm_A, ENABLE);
  
  /* Set the date: Wednesday August 15th 2012 */
  RTC_DateStructure.RTC_Year = 12;
  RTC_DateStructure.RTC_Month = RTC_Month_September;
  RTC_DateStructure.RTC_Date = 11;
  RTC_DateStructure.RTC_WeekDay = RTC_Weekday_Tuesday;
  RTC_SetDate(RTC_Format_BCD, &RTC_DateStructure);
  
  /* Set the time to 01h 00mn 00s AM */
  RTC_TimeStructure.RTC_H12     = RTC_H12_AM;
  RTC_TimeStructure.RTC_Hours   = 0x01;
  RTC_TimeStructure.RTC_Minutes = 0x00;
  RTC_TimeStructure.RTC_Seconds = 0x00; 
  RTC_SetTime(RTC_Format_BCD, &RTC_TimeStructure);    
  
  RTC_ClearFlag(RTC_FLAG_ALRAF);
  
  /* RTC Alarm A Interrupt Configuration */
  /* EXTI configuration */
  EXTI_ClearITPendingBit(EXTI_Line17);
  EXTI_InitStructure.EXTI_Line = EXTI_Line17;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
//.........这里部分代码省略.........
开发者ID:hcc23,项目名称:arm_embedded,代码行数:101,代码来源:main.c

示例8: Sensor_Init

/////////////////////////////////////
///@brief Initialize stm32 pin and sensor  !!!!!!!!******The EXTI IRQ is in EXTI.c********!!!!!
/////////////////////////////////////
void Sensor_Init(void)
{
	GPIO_InitTypeDef GPIO_InitStructure;
	EXTI_InitTypeDef EXTI_InitStructure;
	NVIC_InitTypeDef NVIC_InitStructure; 
	
	RCC_APB2PeriphClockCmd(SENSOR_LIGHT_CLK | SENSOR_GAS_CLK | SENSOR_MOV_CLK | SENSOR_FIRE_CLK | RCC_APB2Periph_AFIO,ENABLE);
	
	//
	GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IN_FLOATING;
	
	GPIO_InitStructure.GPIO_Pin=SENSOR_MOV_PIN;
	GPIO_Init(SENSOR_MOV_GPIO,&GPIO_InitStructure);
	GPIO_InitStructure.GPIO_Pin=SENSOR_FIRE_PIN;
	GPIO_Init(SENSOR_FIRE_GPIO,&GPIO_InitStructure);
	GPIO_InitStructure.GPIO_Pin=SENSOR_LIGHT_PIN;
	GPIO_Init(SENSOR_LIGHT_GPIO,&GPIO_InitStructure);
	GPIO_InitStructure.GPIO_Pin=SENSOR_GAS_PIN;
	GPIO_Init(SENSOR_GAS_GPIO,&GPIO_InitStructure);
	
	

	
	EXTI_ClearITPendingBit(EXTI_Line(SENSOR_GAS_PIN_NUM));//清除中断标志
	GPIO_EXTILineConfig( GPIO_PortSourceGPIOC, GPIO_PinSource(SENSOR_GAS_PIN_NUM)); //引脚映射到外部中断线上
	EXTI_ClearITPendingBit(EXTI_Line(SENSOR_FIRE_PIN_NUM));							//清除中断标志
	GPIO_EXTILineConfig(GPIO_PortSourceGPIOC, GPIO_PinSource(SENSOR_FIRE_PIN_NUM)); //引脚映射到外部中断线上
	EXTI_ClearITPendingBit(EXTI_Line(SENSOR_LIGHT_PIN_NUM));							//清除中断标志
	GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource(SENSOR_LIGHT_PIN_NUM)); //引脚映射到外部中断线上
	EXTI_ClearITPendingBit(EXTI_Line(SENSOR_MOV_PIN_NUM));							//清除中断标志
	GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource(SENSOR_MOV_PIN_NUM)); //引脚映射到外部中断线上
	
	EXTI_InitStructure.EXTI_Mode=EXTI_Mode_Interrupt;		//模式为中断模式  另一个是事件
	EXTI_InitStructure.EXTI_Trigger=EXTI_Trigger_Rising_Falling; 
	EXTI_InitStructure.EXTI_LineCmd=ENABLE;
	
	EXTI_InitStructure.EXTI_Line=EXTI_Line(SENSOR_MOV_PIN_NUM);
	EXTI_Init(&EXTI_InitStructure);
	EXTI_InitStructure.EXTI_Line=EXTI_Line(SENSOR_FIRE_PIN_NUM);
	EXTI_Init(&EXTI_InitStructure);
	EXTI_InitStructure.EXTI_Line=EXTI_Line(SENSOR_LIGHT_PIN_NUM);
	EXTI_Init(&EXTI_InitStructure);
	EXTI_InitStructure.EXTI_Line=EXTI_Line(SENSOR_GAS_PIN_NUM);
	EXTI_Init(&EXTI_InitStructure);
	

	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1); //中断组用四位表示,组0:抢占式优先级0位,副优先级4位,。。。。。。组4:抢占式优先级4位,副优先级0位\
// //	取值情况如下表:
//	 The table below gives the allowed values of the pre-emption priority and subpriority according
// to the Priority Grouping configuration performed by NVIC_PriorityGroupConfig function
//  ============================================================================================================================
//    NVIC_PriorityGroup   | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority  | Description
//  ============================================================================================================================
//   NVIC_PriorityGroup_0  |                0                  |            0-15             |   0 bits for pre-emption priority
//                         |                                   |                             |   4 bits for subpriority
//  ----------------------------------------------------------------------------------------------------------------------------
//   NVIC_PriorityGroup_1  |                0-1                |            0-7              |   1 bits for pre-emption priority
//                         |                                   |                             |   3 bits for subpriority
//  ----------------------------------------------------------------------------------------------------------------------------    
//   NVIC_PriorityGroup_2  |                0-3                |            0-3              |   2 bits for pre-emption priority
//                         |                                   |                             |   2 bits for subpriority
//  ----------------------------------------------------------------------------------------------------------------------------    
//   NVIC_PriorityGroup_3  |                0-7                |            0-1              |   3 bits for pre-emption priority
//                         |                                   |                             |   1 bits for subpriority
//  ----------------------------------------------------------------------------------------------------------------------------    
//   NVIC_PriorityGroup_4  |                0-15               |            0                |   4 bits for pre-emption priority
//                         |                                   |                             |   0 bits for subpriority                       
//  ============================================================================================================================
//*/
	NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; //注意:中断线5~15的中断函数如下,与1~4不同
	NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; 
	NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2; 
	NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; 
	NVIC_Init(&NVIC_InitStructure);
	NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn; //注意:中断线5~15的中断函数如下,与1~4不同
	NVIC_Init(&NVIC_InitStructure);
	NVIC_InitStructure.NVIC_IRQChannel = EXTI1_IRQn; //注意:中断线5~15的中断函数如下,与1~4不同
	NVIC_Init(&NVIC_InitStructure);
}
开发者ID:Neutree,项目名称:Fire-Alarm-System,代码行数:82,代码来源:sensor.c

示例9: EXTI15_10_IRQHandler

void EXTI15_10_IRQHandler(void) //---EXTI15_10 IRQ--//
{
	if(EXTI_GetITStatus(EXTI_Line10))     //--EXTI10--//
	{
		EXTI_ClearITPendingBit(EXTI_Line10); 
	#ifdef USE_EXTI10
		EXTI10_IRQ();
	#endif
		
	#ifdef USE_ULTRASONIC_EXTI10
		pUltExt10->IRQ();
	#endif
		
	#ifdef USE_CAPTURE_EXIT10
	pICPExt10->IRQ();
	#endif
	}
	
	if(EXTI_GetITStatus(EXTI_Line11))     //--EXTI11--//
	{
		EXTI_ClearITPendingBit(EXTI_Line11);
	#ifdef USE_EXTI11
		EXTI11_IRQ();
	#endif
		
	#ifdef USE_ULTRASONIC_EXTI11
		pUltExt11->IRQ();
	#endif
		
	#ifdef USE_CAPTURE_EXIT11
		pICPExt11->IRQ();
	#endif
	}
	
	if(EXTI_GetITStatus(EXTI_Line12))     //--EXTI12--//
	{
		EXTI_ClearITPendingBit(EXTI_Line12);
	#ifdef USE_EXTI12
		EXTI12_IRQ();
	#endif
		
	#ifdef USE_ULTRASONIC_EXTI12
		pUltExt12->IRQ();
	#endif
		
	#ifdef USE_CAPTURE_EXIT12
		pICPExt12->IRQ();
	#endif
	}
	
	if(EXTI_GetITStatus(EXTI_Line13))     //--EXTI13--//
	{
		EXTI_ClearITPendingBit(EXTI_Line13);
	#ifdef USE_EXTI13
		EXTI13_IRQ();
	#endif
		
	#ifdef USE_ULTRASONIC_EXTI13
		pUltExt13->IRQ();
	#endif
		
	#ifdef USE_CAPTURE_EXIT13
		pICPExt13->IRQ();
	#endif
	}
	
	if(EXTI_GetITStatus(EXTI_Line14))     //--EXTI14--//
	{
		EXTI_ClearITPendingBit(EXTI_Line14);
	#ifdef USE_EXTI14
		EXTI14_IRQ();
	#endif
		
	#ifdef USE_ULTRASONIC_EXTI14
		pUltExt14->IRQ();
	#endif
		
	#ifdef USE_CAPTURE_EXIT14
		pICPExt14->IRQ();
	#endif
	}
	
	if(EXTI_GetITStatus(EXTI_Line15))     //--EXTI15--//
	{
		EXTI_ClearITPendingBit(EXTI_Line15);
	#ifdef USE_EXTI15
		EXTI15_IRQ();
	#endif
		
	#ifdef USE_ULTRASONIC_EXTI15
		pUltExt15->IRQ();
	#endif
		
	#ifdef USE_CAPTURE_EXIT15
		pICPExt15->IRQ();
	#endif
	}
}
开发者ID:Neutree,项目名称:Gimbal,代码行数:98,代码来源:Interrupt.cpp

示例10: main

/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f0xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f0xx.c file
     */ 

  NVIC_InitTypeDef  NVIC_InitStructure;
  EXTI_InitTypeDef  EXTI_InitStructure;
  USART_InitTypeDef USART_InitStructure;
     
  /* USARTx configured as follow:
        - BaudRate = 115200 baud  
        - Word Length = 8 Bits
        - One Stop Bit
        - No parity
        - Hardware flow control disabled (RTS and CTS signals)
        - Receive and transmit enabled
  */
  USART_InitStructure.USART_BaudRate = 115200;
  USART_InitStructure.USART_WordLength = USART_WordLength_8b;
  USART_InitStructure.USART_StopBits = USART_StopBits_1;
  USART_InitStructure.USART_Parity = USART_Parity_No;
  USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
  USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

  STM_EVAL_COMInit(COM1, &USART_InitStructure);
 
  /* Output a message on Hyperterminal using printf function */
  printf("\n\r  *********************** RTC Hardware Calendar Example ***********************\n\r");
  
  if (RTC_ReadBackupRegister(RTC_BKP_DR0) != BKP_VALUE)
  {  
    /* RTC configuration  */
    RTC_Config();

    /* Configure the RTC data register and RTC prescaler */
    RTC_InitStructure.RTC_AsynchPrediv = AsynchPrediv;
    RTC_InitStructure.RTC_SynchPrediv = SynchPrediv;
    RTC_InitStructure.RTC_HourFormat = RTC_HourFormat_24;
   
    /* Check on RTC init */
    if (RTC_Init(&RTC_InitStructure) == ERROR)
    {
      printf("\n\r        /!\\***** RTC Prescaler Config failed ********/!\\ \n\r");
    }

    /* Configure the time register */
    RTC_TimeRegulate(); 
  }
  else
  {
    /* Check if the Power On Reset flag is set */
    if (RCC_GetFlagStatus(RCC_FLAG_PORRST) != RESET)
    {
      printf("\r\n Power On Reset occurred....\n\r");
    }
    /* Check if the Pin Reset flag is set */
    else if (RCC_GetFlagStatus(RCC_FLAG_PINRST) != RESET)
    {
      printf("\r\n External Reset occurred....\n\r");
    }

    printf("\n\r No need to configure RTC....\n\r");
    
    /* Enable the PWR clock */
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);

    /* Allow access to RTC */
    PWR_BackupAccessCmd(ENABLE);

 #ifdef RTC_CLOCK_SOURCE_LSI
    /* Enable the LSI OSC */ 
    RCC_LSICmd(ENABLE);
 #endif /* RTC_CLOCK_SOURCE_LSI */

    /* Wait for RTC APB registers synchronisation */
    RTC_WaitForSynchro();

    /* Clear the RTC Alarm Flag */
    RTC_ClearFlag(RTC_FLAG_ALRAF);

    /* Clear the EXTI Line 17 Pending bit (Connected internally to RTC Alarm) */
    EXTI_ClearITPendingBit(EXTI_Line17);

    /* Display the RTC Time and Alarm */
    RTC_TimeShow();
    RTC_AlarmShow();
  }
   
  /* Configure the external interrupt "KEY", "SEL" and "UP" buttons */
  STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_EXTI); 
  STM_EVAL_PBInit(BUTTON_SEL, BUTTON_MODE_EXTI);
//.........这里部分代码省略.........
开发者ID:Amna2013,项目名称:stm32-test,代码行数:101,代码来源:main.c

示例11: RTCTime_Test

/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
void RTCTime_Test(void)
{
    uart_init();

    /* Output a message on Hyperterminal using printf function */
    printf("\n\r  *********************** RTC Time Stamp Example ***********************\n\r");
    
    if (RTC_ReadBackupRegister(RTC_BKP_DR0) != 0x32F2)
    {
        /* RTC configuration  */
        RTC_Config();
        
        /* Configure the RTC data register and RTC prescaler */
        RTC_InitStructure.RTC_AsynchPrediv = AsynchPrediv;
        RTC_InitStructure.RTC_SynchPrediv = SynchPrediv;
        RTC_InitStructure.RTC_HourFormat = RTC_HourFormat_24;
        
        /* Check on RTC init */
        if (RTC_Init(&RTC_InitStructure) == ERROR)
        {
            printf("\n\r        /!\\***** RTC Prescaler Config failed ********/!\\ \n\r");
        }
        
        /* Configure the time register */
        RTC_TimeRegulate(); 
    }
    else
    {
        /* Check if the Power On Reset flag is set */
        if (RCC_GetFlagStatus(RCC_FLAG_PORRST) != RESET)
        {
          printf("\r\n Power On Reset occurred....\n\r");
        }
        /* Check if the Pin Reset flag is set */
        else if (RCC_GetFlagStatus(RCC_FLAG_PINRST) != RESET)
        {
          printf("\r\n External Reset occurred....\n\r");
        }
        
        printf("\r\n No need to configure RTC....\n\r");
        
        /* Enable the PWR clock */
        RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
        
        /* Allow access to RTC */
        PWR_BackupAccessCmd(ENABLE);
        
        /* Wait for RTC APB registers synchronisation */
        RTC_WaitForSynchro();
        
        /* Clear the RTC Alarm Flag */
        RTC_ClearFlag(RTC_FLAG_ALRAF);
        
        /* Clear the EXTI Line 17 Pending bit (Connected internally to RTC Alarm) */
        EXTI_ClearITPendingBit(EXTI_Line17);
        
        /* Display the RTC Time/Date and TimeStamp Time/Date */
        RTC_TimeShow();
        RTC_DateShow();
        RTC_TimeStampShow();
    }

    PUTOUT_KeyInit();
    
    while (1)
    {
    
    }
}
开发者ID:captain168,项目名称:stm32f4_honglong,代码行数:74,代码来源:RTC_Time.c

示例12: EXTI15_10_IRQHandler


//.........这里部分代码省略.........
  */
void EXTI15_10_IRQHandler(void)
{
  /* Checks whether the IOE EXTI line is asserted or not */
  if(EXTI_GetITStatus(IOE_IT_EXTI_LINE) != RESET)
  {

#ifdef IOE_INTERRUPT_MODE
    /* Check if the interrupt source is the Touch Screen */
    if (IOE_GetGITStatus(IOE_1_ADDR, IOE_TS_IT) & IOE_TS_IT)
    {
      static TS_STATE* TS_State;

      /* Update the structure with the current position */
      TS_State = IOE_TS_GetState();

      if ((TS_State->TouchDetected) && (TS_State->Y < 220) && (TS_State->Y > 180))
      {
        if ((TS_State->X > 10) && (TS_State->X < 70))
        {
          LCD_DisplayStringLine(Line6, " LD4                ");
          STM_EVAL_LEDOn(LED4);
        }
        else if ((TS_State->X > 90) && (TS_State->X < 150))
        {
          LCD_DisplayStringLine(Line6, "      LD3           ");
          STM_EVAL_LEDOn(LED3);
        }
        else if ((TS_State->X > 170) && (TS_State->X < 230))
        {
          LCD_DisplayStringLine(Line6, "           LD2      ");
          STM_EVAL_LEDOn(LED2);
        }
        else if ((TS_State->X > 250) && (TS_State->X < 310))
        {
          LCD_DisplayStringLine(Line6, "                LD1 ");
          STM_EVAL_LEDOn(LED1);
        }
      }
      else
      {
        STM_EVAL_LEDOff(LED1);
        STM_EVAL_LEDOff(LED2);
        STM_EVAL_LEDOff(LED3);
        STM_EVAL_LEDOff(LED4);
      }

      /* Clear the interrupt pending bits */
      IOE_ClearGITPending(IOE_1_ADDR, IOE_TS_IT);
    }
 #ifdef USE_STM3210C_EVAL
    else if (IOE_GetGITStatus(IOE_2_ADDR, IOE_GIT_GPIO))
    {
      static JOY_State_TypeDef JoyState = JOY_NONE;

      /* Get the Joystick State */
      JoyState = IOE_JoyStickGetState();

      switch (JoyState)
      {
      case JOY_NONE:
        LCD_DisplayStringLine(Line5, "JOY: IT  ----       ");
        break;
      case JOY_UP:
        LCD_DisplayStringLine(Line5, "JOY: IT  UP         ");
        break;
      case JOY_DOWN:
        LCD_DisplayStringLine(Line5, "JOY: IT DOWN        ");
        break;
      case JOY_LEFT:
        LCD_DisplayStringLine(Line5, "JOY: IT LEFT        ");
        break;
      case JOY_RIGHT:
        LCD_DisplayStringLine(Line5, "JOY: IT  RIGHT      ");
        break;
      case JOY_CENTER:
        LCD_DisplayStringLine(Line5, "JOY: IT CENTER      ");
        break;
      default:
        LCD_DisplayStringLine(Line5, "JOY: IT ERROR       ");
        break;
      }

      /* Clear the interrupt pending bits */
      IOE_ClearGITPending(IOE_2_ADDR, IOE_GIT_GPIO);
      IOE_ClearIOITPending(IOE_2_ADDR, IOE_JOY_IT);
    }
    /* CLear all pending interrupt */
    IOE_ClearGITPending(IOE_2_ADDR, ALL_IT);
    IOE_ClearIOITPending(IOE_2_ADDR, IOE_JOY_IT);
 #endif /* USE_STM3210C_EVAL */

    /* CLear all pending interrupt */
    IOE_ClearGITPending(IOE_1_ADDR, ALL_IT);

#endif /* IOE_INTERRUPT_MODE */

    EXTI_ClearITPendingBit(IOE_IT_EXTI_LINE);
  }
}
开发者ID:Joe-Merten,项目名称:Stm32,代码行数:101,代码来源:stm32f10x_it.c

示例13: EXTI0_IRQHandler

/**
 * @brief  EXTI0_IRQHandler
 *         This function handles External line 0 interrupt request.
 * @param  None
 * @retval None
 */
void EXTI0_IRQHandler(void) {

	/* Clears the EXTI's line pending bit.*/
	EXTI_ClearITPendingBit(EXTI_Line0);
}
开发者ID:PUT-PTM,项目名称:STMAudio,代码行数:11,代码来源:stm32f4xx_it.c

示例14: EXTI1_IRQHandler

/**
 * @brief  This function handles External line 1 interrupt request.
 * @param  None
 * @retval None
 */
void EXTI1_IRQHandler(void) {

	EXTI_ClearITPendingBit(EXTI_Line1);
}
开发者ID:PUT-PTM,项目名称:STMAudio,代码行数:9,代码来源:stm32f4xx_it.c

示例15: HAL_Interrupts_Attach

void HAL_Interrupts_Attach(uint16_t pin, HAL_InterruptHandler handler, void* data, InterruptMode mode, HAL_InterruptExtraConfiguration* config)
{
  uint8_t GPIO_PortSource = 0;    //variable to hold the port number

  //EXTI structure to init EXT
  EXTI_InitTypeDef EXTI_InitStructure = {0};
  //NVIC structure to set up NVIC controller
  NVIC_InitTypeDef NVIC_InitStructure = {0};

  //Map the Spark pin to the appropriate port and pin on the STM32
  STM32_Pin_Info* PIN_MAP = HAL_Pin_Map();
  GPIO_TypeDef *gpio_port = PIN_MAP[pin].gpio_peripheral;
  uint16_t gpio_pin = PIN_MAP[pin].gpio_pin;
  uint8_t GPIO_PinSource = PIN_MAP[pin].gpio_pin_source;


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

  //Select the port source
  if (gpio_port == GPIOA)
  {
    GPIO_PortSource = 0;
  }
  else if (gpio_port == GPIOB)
  {
    GPIO_PortSource = 1;
  }
  else if (gpio_port == GPIOC)
  {
    GPIO_PortSource = 2;
  }
  else if (gpio_port == GPIOD)
  {
    GPIO_PortSource = 3;
  }

  // Register the handler for the user function name
  if (config && config->version >= HAL_INTERRUPT_EXTRA_CONFIGURATION_VERSION_2 && config->keepHandler) {
    // keep the old handler
  } else {
    exti_channels[GPIO_PinSource].fn = handler;
    exti_channels[GPIO_PinSource].data = data;
  }

  //Connect EXTI Line to appropriate Pin
  SYSCFG_EXTILineConfig(GPIO_PortSource, GPIO_PinSource);

  //Configure GPIO EXTI line
  EXTI_InitStructure.EXTI_Line = gpio_pin;//EXTI_Line;

  //select the interrupt mode
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  switch (mode)
  {
    //case LOW:
    //There is no LOW mode in STM32, so using falling edge as default
    //EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
    //break;
    case CHANGE:
      //generate interrupt on rising or falling edge
      EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
      break;
    case RISING:
      //generate interrupt on rising edge
      EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
      break;
    case FALLING:
      //generate interrupt on falling edge
      EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
      break;
  }

  //enable EXTI line
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  //send values to registers
  EXTI_Init(&EXTI_InitStructure);

  //configure NVIC
  //select NVIC channel to configure
  NVIC_InitStructure.NVIC_IRQChannel = GPIO_IRQn[GPIO_PinSource];
  if (config == NULL) {
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 14;
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  } else {
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = config->IRQChannelPreemptionPriority;
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = config->IRQChannelSubPriority;

    // Keep the same priority
    if (config->version >= HAL_INTERRUPT_EXTRA_CONFIGURATION_VERSION_2) {
      if (config->keepPriority) {
        uint32_t priorityGroup = NVIC_GetPriorityGrouping();
        uint32_t priority = NVIC_GetPriority(NVIC_InitStructure.NVIC_IRQChannel);
        uint32_t p, sp;
        NVIC_DecodePriority(priority, priorityGroup, &p, &sp);
        NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = p;
        NVIC_InitStructure.NVIC_IRQChannelSubPriority = sp;
      }
    }
  }
//.........这里部分代码省略.........
开发者ID:spark,项目名称:firmware,代码行数:101,代码来源:interrupts_hal.c


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