Пример #1
0
/*******************************************************************************
* 函 数 名:	
* 功    能:	
* 参    数:
* 返    回:	
*******************************************************************************/
void RTC_IRQHandler(void)
{	
	//秒钟中断	    
	if( RTC_GetITStatus(RTC_IT_SEC) != RESET )
	{							
		if( sec_irq_handle != NULL)
		{
			sec_irq_handle();	
		}
		
		RTC_ClearITPendingBit(RTC_IT_SEC);
	}
	//闹钟中断
	if(RTC_GetITStatus(RTC_IT_ALR) != RESET)
	{
		if(alrf_irq_hanle != NULL)
		{
			alrf_irq_hanle();
		}
		RTC_ClearITPendingBit(RTC_IT_ALR);
	} 	
	//溢出中断
	if(RTC_GetITStatus(RTC_IT_OW) != RESET)
	{
		if(ow_irq_hanle != NULL)
		{
			ow_irq_hanle();
		}
		RTC_ClearITPendingBit(RTC_IT_OW);
	}	   	
	RTC_WaitForLastTask();				 	   	 
}
Пример #2
0
/*
************************************************************
*	函数名称:	RTC_IRQHandler
*
*	函数功能:	RTC一般功能中断
*
*	入口参数:	无
*
*	返回参数:	无
*
*	说明:		
************************************************************
*/
void RTC_IRQHandler(void)
{

	//秒中断
	if(RTC_GetITStatus(RTC_IT_SEC))
	{
		RTC_ClearITPendingBit(RTC_IT_SEC); //清秒中断
		//........do something
	}
	//溢出中断
	if(RTC_GetITStatus(RTC_IT_OW))
	{
		RTC_ClearITPendingBit(RTC_IT_OW); //清溢出中断
		//........do something
	}
	//闹钟中断
	if(RTC_GetITStatus(RTC_IT_ALR))
	{
		RTC_ClearITPendingBit(RTC_IT_ALR); //清闹钟中断
		//........do something
	}
	
	RTC_WaitForLastTask(); //等待操作完成

}
Пример #3
0
/*
 * RTC wakeup interrupt handler.
 */
void RTC_WKUP_IRQHandler(void)
{
#if POSCFG_FEATURE_TICKLESS != 0

  if (RTC_GetITStatus(RTC_IT_WUT) != RESET) {

/*
 * Stop wakeup counter and ensure 
 * system wakes up from sleep.
 */
    RTC_WakeUpCmd(DISABLE);
    RTC_ClearITPendingBit(RTC_IT_WUT);
    EXTI_ClearITPendingBit(EXTI_Line22);
    SCB->SCR &= ~SCB_SCR_SLEEPONEXIT_Msk;
  }

#else

  c_pos_intEnter();

  if (RTC_GetITStatus(RTC_IT_WUT) != RESET) {

    RTC_ClearITPendingBit(RTC_IT_WUT);
    EXTI_ClearITPendingBit(EXTI_Line22);
    c_pos_timerInterrupt();
  }

  c_pos_intExitQuick();

#endif
}
Пример #4
0
void RTC_IRQHandler(void)
{
    if (RTC_GetITStatus(RTC_IT_SEC) != RESET)
    {
    /* Clear the RTC Second interrupt */
    RTC_ClearITPendingBit(RTC_IT_SEC);

    /* Enable time update */

    /* Wait until last write operation on RTC registers has finished */
    RTC_WaitForLastTask();
    Time_Display();
    }

    if (RTC_GetITStatus(RTC_IT_ALR) != RESET)
    {
    /* Clear the RTC Second interrupt */
    RTC_ClearITPendingBit(RTC_IT_ALR);

    /* Enable time update */

    /* Wait until last write operation on RTC registers has finished */
    RTC_WaitForLastTask();
    printf(" RTC WAKEUP\r\n");
    }
}
Пример #5
0
void RTC_IRQHandler(void) {
#ifdef STM32F1
  RTC_ClearITPendingBit(RTC_IT_ALR);
#else
  RTC_ClearITPendingBit(RTC_IT_ALRA);
#endif
}
Пример #6
0
void rtcIrqHandler(void)
{
    if (RTC_GetITStatus(RTC_IT_SEC) != RESET) {
        RTC_ClearITPendingBit(RTC_FLAG_SEC);
#ifdef PRECISION_IN_MS
        if (RTC_GetCounter() / 999 >= 1) {
            RTC_WaitForLastTask();
            RTC_SetCounter(0);
            RTC_WaitForLastTask();

            ++seconds;
        }
#endif
    }

    /* ignore overflow */
    //if (RTC_GetITStatus(RTC_IT_OW) != RESET) {
    //    RTC_ClearITPendingBit(RTC_FLAG_OW);
    //}
#ifndef PRECISION_IN_MS
    if (RTC_GetITStatus(RTC_IT_ALR) != RESET) {
        RTC_ClearITPendingBit(RTC_FLAG_ALR);
        if (alarm > 0 && alarm != NULL) {
            alarmProc();
        }
    }
#else
    if (alarm > 0 && alarm == seconds
        && alarm != NULL) {
        alarmProc();
    }
#endif
}
Пример #7
0
//RTC时钟中断
//每秒触发一次  
//extern u16 tcnt; 
void RTC_IRQHandler(void)
{		 
	if (RTC_GetITStatus(RTC_IT_SEC) != RESET)//秒钟中断
	{							
		RTC_Get();//更新时间   
 	}
	if(RTC_GetITStatus(RTC_IT_ALR)!= RESET)//闹钟中断
	{
		RTC_ClearITPendingBit(RTC_IT_ALR);		//清闹钟中断	  	   
  	} 				  								 
	RTC_ClearITPendingBit(RTC_IT_SEC|RTC_IT_OW);		//清闹钟中断
	RTC_WaitForLastTask();	  	    						 	   	 
}
Пример #8
0
void rtc_event(void)
{
	if(RTC_GetITStatus(RTC_IT_SEC) != RESET)
	{
		/* Clear the RTC Second interrupt */
		RTC_ClearITPendingBit(RTC_IT_SEC);

		/* Toggle led connected to PC.06 pin each 1s */
		GPIO_WriteBit(GPIOC, GPIO_Pin_6, (BitAction)(1-GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_6)));

		/* Enable time update */
		if( s_rtc_service )
		{
			time_show();
		}

		/* Wait until last write operation on RTC registers has finished */
		RTC_WaitForLastTask();
		/* Reset RTC Counter when Time is 23:59:59 */
		if(RTC_GetCounter() == 0x00015180)
		{
			RTC_SetCounter(0x0);
			/* Wait until last write operation on RTC registers has finished */
			RTC_WaitForLastTask();
		}
	}
}
void RTC_Alarm_IRQHandler(void)
{
    if(RTC_GetITStatus(RTC_IT_ALRA) != RESET){
        RTC_ClearITPendingBit(RTC_IT_ALRA);
        EXTI_ClearITPendingBit(EXTI_Line17);
    } 
}
Пример #10
0
/*******************************************************************************
* Function Name  : RTC_IRQHandler
* Description    : This function handles RTC global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void RTC_IRQHandler(void)
{
  volatile unsigned long int stanRTC;
  static unsigned char stanRTCTekst[17] = {"0\0"};
  unsigned long int godziny, minuty, sekundy;

  if (RTC_GetITStatus(RTC_IT_SEC) != RESET)
  {
    // Czekaj na zakonczenie ewentualnych operacji zapisu do rejestrów RTC
    RTC_WaitForLastTask();

    // Wyczysc flage od przerwania RTC
    RTC_ClearITPendingBit(RTC_IT_SEC);

    // Zmiana stanu wyprowadzenia PB15 co 1s
    GPIO_WriteBit(GPIOB, GPIO_Pin_15, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIOB, GPIO_Pin_15)));

		stanRTC=RTC_GetCounter();
    //sprintf((char *)stanRTCTekst,"%16i\0",stanRTC);
    //LCD_WriteTextXY(stanRTCTekst,0,1);		   

    sekundy=stanRTC%60;               //liczba sekund od ostatniej pelnej minuty
    minuty=(long int)(stanRTC)/60;    //dzielenie calkowite, "usuniecie" sekund, czas pracy w samych minutach
    godziny=(long int)(minuty)/60;    //dzielenie calkowite, "usuniecie" minut, czas pracy w samych godzinach
    minuty=minuty%60;                 //liczba minut od ostatniej pelnej godziny

    sprintf((char *)stanRTCTekst,"%3i:%02i:%02i\0",godziny,minuty,sekundy);
    LCD_WriteTextXY(stanRTCTekst,7,1);	
  }
}
Пример #11
0
/*******************************************************************************
* Function Name  : RTCAlarm_IRQHandler
* Description    : This function handles RTC Alarm interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void RTCAlarm_IRQHandler(void)
{
	if(RTC_GetITStatus(RTC_IT_ALR) != RESET)
	{
		SPARK_WLAN_SLEEP = 0;

		/* Clear EXTI line17 pending bit */
		EXTI_ClearITPendingBit(EXTI_Line17);

		/* Check if the Wake-Up flag is set */
		if(PWR_GetFlagStatus(PWR_FLAG_WU) != RESET)
		{
			/* Clear Wake Up flag */
			PWR_ClearFlag(PWR_FLAG_WU);
		}

		/* Wait until last write operation on RTC registers has finished */
		RTC_WaitForLastTask();

		/* Clear RTC Alarm interrupt pending bit */
		RTC_ClearITPendingBit(RTC_IT_ALR);

		/* Wait until last write operation on RTC registers has finished */
		RTC_WaitForLastTask();
	}
}
Пример #12
0
//RTC时钟中断
//每秒触发一次  
//extern u16 tcnt; 
void RTC_IRQHandler(void)
{		 
	if (RTC_GetITStatus(RTC_IT_SEC) != RESET)//秒钟中断
	{							
		RTC_Get();//更新时间   
 	}
	if(RTC_GetITStatus(RTC_IT_ALR)!= RESET)//闹钟中断
	{
		RTC_ClearITPendingBit(RTC_IT_ALR);		//清闹钟中断	  	
	  RTC_Get();				//更新时间   
  	printf("Alarm Time:%d-%d-%d %d:%d:%d\n",calendar.w_year,calendar.w_month,calendar.w_date,calendar.hour,calendar.min,calendar.sec);//输出闹铃时间	
		
  	} 				  								 
	RTC_ClearITPendingBit(RTC_IT_SEC|RTC_IT_OW);		//清闹钟中断
	RTC_WaitForLastTask();	  	    						 	   	 
}
Пример #13
0
void RTC_IRQHandler(void)
{
	/* 判断中断标志位_秒中断 是否被置位 */
	if (RTC_GetITStatus(RTC_IT_SEC) != RESET)
	{
		/* Clear the RTC Second interrupt */
		RTC_ClearITPendingBit(RTC_IT_SEC);
		
		/* Toggle GPIO_LED pin 6 each 1s */
		//GPIO_WriteBit(GPIO_LED, GPIO_Pin_6, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIO_LED, GPIO_Pin_6)));
		
		/* Enable time update
		 * TimeDisplay是一个标志位,只有等于1时才让串口发送时 间数据,即让串口一秒发一次时间值 */
		TimeDisplay = 1;
		
		/* Wait until last write operation on RTC registers has finished */
		RTC_WaitForLastTask();
		/* Reset RTC Counter when Time is 23:59:59
		 * 当时间走到23:59:59秒时RTC计数器中的值清零,0x00015180=23*3600+56*60+59 */
		if (RTC_GetCounter() == 0x00015180)
		{
			RTC_SetCounter(0x0);
			/* Wait until last write operation on RTC registers has finished */
			RTC_WaitForLastTask();
		}
	}
}
Пример #14
0
/*******************************************************************************
 * Function Name  : RTC_IRQHandler
 * Description    : This function handles RTC global interrupt request.
 * Input          : None
 * Output         : None
 * Return         : None
 *******************************************************************************/
void RTC_IRQHandler(void)
{
	if(RTC_GetITStatus(RTC_IT_SEC) != RESET)
	{
//		/* If counter is equal to 86339: one day was elapsed */
//		if((RTC_GetCounter() / 3600 == 23)
//				&& (((RTC_GetCounter() % 3600) / 60) == 59)
//				&& (((RTC_GetCounter() % 3600) % 60) == 59)) /* 23*3600 + 59*60 + 59 = 86339 */
//		{
//			/* Wait until last write operation on RTC registers has finished */
//			RTC_WaitForLastTask();
//
//			/* Reset counter value */
//			RTC_SetCounter(0x0);
//
//			/* Wait until last write operation on RTC registers has finished */
//			RTC_WaitForLastTask();
//
//			/* Increment no_of_days_elapsed variable here */
//		}

		/* Clear the RTC Second Interrupt pending bit */
		RTC_ClearITPendingBit(RTC_IT_SEC);

		/* Wait until last write operation on RTC registers has finished */
		RTC_WaitForLastTask();
	}
}
Пример #15
0
void p_pos_powerTickResume()
{
/*
 * Make sure that wakeup counter is disabled.
 */
  NVIC_DisableIRQ(RTC_WKUP_IRQn);
  RTC_WakeUpCmd(DISABLE);
  RTC_ClearITPendingBit(RTC_IT_WUT);
  EXTI_ClearITPendingBit(EXTI_Line22);

/*
 * Do application-specific clock setup after sleep.
 */
  portRestoreClocksAfterWakeup();

/*
 * Now step the timer with amount of ticks we really slept.
 */
  c_pos_timerStep(HZ * (rtcTimeNow() - startTime) / 1000);

/*
 * Safe to enable systick now.
 */
  SysTick->CTRL |= (SysTick_CTRL_TICKINT_Msk |
                    SysTick_CTRL_ENABLE_Msk);
}
Пример #16
0
void RTC_IRQHandler(void)
{
    long xHigherPriorityTaskWoken = pdFALSE;

    current_rtime.sec += 1;
    if (current_rtime.sec >= 60) {
        current_rtime.sec -= 60;
        current_rtime.min += 1;
        if (current_rtime.min >= 60) {
            current_rtime.min -= 60;
            current_rtime.hour += 1;
            if (current_rtime.hour >= 24) {
                current_rtime.hour -= 24;
            }
        }

        struct guievent gevnt;
        gevnt.evnt = GUI_E_CLOCK;
        gevnt.buf = NULL;
        gevnt.kpar = 0;
        xQueueSendFromISR(toGuiQueue, &gevnt, &xHigherPriorityTaskWoken);
    }

    /* clear RTC irq pending bit of the 'seconds' irq */
    RTC_ClearITPendingBit(RTC_IT_SEC);

    /* signal end-of-irq and possible reschedule point */
    portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
}
Пример #17
0
void RTC_Alarm_IRQHandler()
{
    if(RTC_GetITStatus(RTC_IT_ALRA) != RESET)
    {
    	//RTC_AlarmCmd(RTC_Alarm_A, ENABLE);

    	PWR_RTCAccessCmd(ENABLE); // Доступ в RTC
    	RTC_ClearITPendingBit(RTC_IT_ALRA);
    	RTC_ClearFlag(RTC_FLAG_ALRAF);
    	PWR_RTCAccessCmd(DISABLE);

        EXTI_ClearITPendingBit(EXTI_Line17);
        //OLED_DrawString_fast(0,0,"alarm",10);
    }

    /////////////////////////?????????????????????????????????????????????????????????????????????????????????????
    if(RTC_GetFlagStatus(RTC_FLAG_ALRAF) != RESET)
    {
    	PWR_RTCAccessCmd(ENABLE);
    	RTC_ClearFlag(RTC_FLAG_ALRAF);
    	PWR_RTCAccessCmd(DISABLE);
    	//f_WakeupToAlarm=1;
    	curent_cmd = 5;

    }
/////////////////////////



}
Пример #18
0
/*******************************************************************************
* Function Name  : RTC_IRQHandler
* Description    : This function handles RTC global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void RTC_IRQHandler(void)
{
    if(RTC_GetFlagStatus(RTC_IT_ALR) != RESET)
    {
      RTC_ClearITPendingBit(RTC_IT_ALR);      //Clear RTC Alarm interrupt pending bit
      RTC_WaitForLastTask();                  //Wait until last write operation on RTC registers has finished
    }
}
Пример #19
0
/*******************************************************************************
* Function Name  : RTC_IRQHandler
* Description    : This function handles RTC global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void RTC_IRQHandler(void)
{
  if( RTC_GetITStatus(RTC_IT_ALR) == SET ) {
    cmdPowerUp();  // it's a hard kick in the pants!
    
    RTC_ClearITPendingBit(RTC_IT_ALR);
  }
}
Пример #20
0
void RTC_WKUP_IRQHandler(void)
{
  if (RTC_GetITStatus(RTC_IT_WUT) != RESET) {
    EXTI_ClearITPendingBit(EXTI_Line22);
    RTC_ClearITPendingBit(RTC_IT_WUT);
    RTC_ClearFlag(RTC_FLAG_WUTF);
  }
}
Пример #21
0
void RTC_IRQHandler(void)
{
  if (RTC_GetITStatus(RTC_IT_SEC) != RESET)
  {
	/* Clear the RTC Second interrupt */
	RTC_ClearITPendingBit(RTC_IT_SEC);  
  }
}
Пример #22
0
/**
  * @brief  This function handles RTC Wakeup global interrupt request.
  * @param  None
  * @retval None
  */
void RTC_WKUP_IRQHandler(void) {
  if(RTC_GetITStatus(RTC_IT_WUT) != RESET) {
    RTC_ClearITPendingBit(RTC_IT_WUT);
    EXTI_ClearITPendingBit(EXTI_Line22);    
  
    WUFlag = true;
  }
}
Пример #23
0
/**
  * @brief  This function handles RTC Alarm interrupt (A and B) request.
  * @param  None
  * @retval None
  */
void RTC_Alarm_IRQHandler(void)
{
  uint32_t tmp =0;
  
  /* Check on the AlarmA falg and on the number of interrupts per Second (60*8) */
  if(RTC_GetITStatus(RTC_IT_ALRA) != RESET) 
  { 
    /* Clear RTC AlarmA Flags */
    RTC_ClearITPendingBit(RTC_IT_ALRA);
    
    /* Generate alarms 480 = 60 * 8 */   
    if(RTCAlarmCount != (8 * SecondNumb))
    {
      /* Increament the counter of Alarma interrupts*/
      RTCAlarmCount++;
      
      
      /* Define the rate of Progress bar */
      tmp = (uint32_t) ((RTCAlarmCount * 100)/ (8 * SecondNumb)); 
      
      /* Set the LCD text color */
      LCD_SetTextColor(Blue);
      
      /* Set the LCD Font */
      LCD_SetFont(&Font16x24);
      
      /* Display Char on the LCD : XXX% */
      LCD_DisplayChar(40,110, (tmp / 100) +0x30);
      LCD_DisplayChar(40,88, ((tmp  % 100 ) / 10) +0x30);
      LCD_DisplayChar(40,66, (tmp % 10) +0x30);
      LCD_DisplayChar(40,44, 0x25);   
      
      if(SecondNumb > 13)
      {
        if((tmp % 2) == 0 )
        {  
          /* Set the LCD text color */
          LCD_SetTextColor(White);
          LCD_DrawLine(70 + (tmp/2) , 120 - (tmp/2)  , 100 - tmp  ,Horizontal);
          LCD_DrawLine(170 - (tmp/2) , 120 - (tmp/2)  , 100 - tmp ,Horizontal);
          
          /* Set the LCD Text Color */
          LCD_SetTextColor(Blue);
          LCD_DrawLine(170 - (tmp/2) , 120 - (tmp/2)  , 100 - tmp ,Horizontal);
          
        }
      }      
    }
    else
    {
      StartEvent = 9;
      /* Disable the alarmA */
      RTC_AlarmCmd(RTC_Alarm_A, DISABLE);
    }
  }
  /* Clear the EXTIL line 17 */
  EXTI_ClearITPendingBit(EXTI_Line17);
}
Пример #24
0
/*******************************************************************************
* Function Name  : RTC_IRQHandler
* Description    : This function handles RTC global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void RTC_IRQHandler(void)
{
#ifdef USE_RTC
  NVIC_ClearIRQChannelPendingBit(RTC_IRQChannel);
  RTC_ClearITPendingBit(RTC_IT_SEC);

  //CallTrace(TRACE_DRV_HIGH," RTC ISR = %d\n\r", RTC_GetCounter());
#endif
}
Пример #25
0
/**
  * @brief  This function handles RTC Alarm interrupt request.
  * @param  None
  * @retval None
  */
void RTC_Alarm_IRQHandler(void)
{
  if(RTC_GetITStatus(RTC_IT_ALRA) != RESET)
  {
    STM_EVAL_LEDToggle(LED1);
    RTC_ClearITPendingBit(RTC_IT_ALRA);
    EXTI_ClearITPendingBit(EXTI_Line17);
  } 
}
Пример #26
0
/**
  * @brief  This function handles RTC Auto wake-up interrupt request.
  * @param  None
  * @retval None
  */
void RTC_WKUP_IRQHandler(void)
{
  if(RTC_GetITStatus(RTC_IT_WUT) != RESET)
  {
    /* Clear RTC and EXTI interrupt flags */
  	RTC_ClearITPendingBit(RTC_IT_WUT);
  	EXTI_ClearITPendingBit(EXTI_Line20);    
  } 
}
Пример #27
0
/**
  * @brief  This function handles RTC Wakeup Timer Handler.
  * @param  None
  * @retval None
  */
void RTC_WKUP_IRQHandler(void)
{
  if(RTC_GetITStatus(RTC_IT_WUT) != RESET)
  {
    uwTimeDisplay = 1;
    RTC_ClearITPendingBit(RTC_IT_WUT);
    EXTI_ClearITPendingBit(EXTI_Line22);
  }
}
/**
  * @brief  This function handles RTC Wakeup global interrupt request.
  * @param  None
  * @retval None
  */
void RTC_WKUP_IRQHandler(void)
{
  if(RTC_GetITStatus(RTC_IT_WUT) != RESET)
  {
    /* Toggle on LED1 */
    STM_EVAL_LEDToggle(LED1);
    RTC_ClearITPendingBit(RTC_IT_WUT);
    EXTI_ClearITPendingBit(EXTI_Line22);
  } 
}
Пример #29
0
//------------------------------------------------------------------------------
void RTC_IRQHandler(void)
{
	if(RTC_GetITStatus(RTC_IT_ALRA) != RESET) {
		//USART_SendData(USART1, 'a');
#ifdef USE_SERIAL
		usart_str("rtc irq\n");
#endif
		RTC_ClearITPendingBit(RTC_IT_ALRA);
	}
}
/**
  * @brief  This function handles RTC global interrupt request.
  * @param  None
  * @retval None
  */
void RTC_IRQHandler(void)
{
    if (RTC_GetITStatus(RTC_IT_ALRA) != RESET){
        RTC_ClearITPendingBit(RTC_IT_ALRA);
        if(stm32f4xx_int_cb_tbl[STM32F4xx_INT_RTC_ALRA]){
            stm32f4xx_int_cb_tbl[STM32F4xx_INT_RTC_ALRA]();
        }
        RTC_WaitForSynchro();
//        RTC_WaitForLastTask();
    }
    if (RTC_GetITStatus(RTC_IT_ALRB) != RESET){
        RTC_ClearITPendingBit(RTC_IT_ALRB);
        if(stm32f4xx_int_cb_tbl[STM32F4xx_INT_RTC_ALRB]){
            stm32f4xx_int_cb_tbl[STM32F4xx_INT_RTC_ALRB]();
        }
        RTC_WaitForSynchro();
//        RTC_WaitForLastTask();
    }
}