/*********************************************************************//**
 * @brief		RTC interrupt handler sub-routine
 * @param[in]	None
 * @return 		None
 **********************************************************************/
void RTC_IRQHandler(void)
{
	uint32_t secval;

	/* This is increment counter interrupt*/
	if (RTC_GetIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE))
	{
		secval = RTC_GetTime (LPC_RTC, RTC_TIMETYPE_SECOND);

		/* Send debug information */
		_DBG ("Second: "); _DBD(secval);
		_DBG_("");

		// Clear pending interrupt
		RTC_ClearIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE);
	}

	/* Continue to check the Alarm match*/
	if (RTC_GetIntPending(LPC_RTC, RTC_INT_ALARM))
	{
		/* Send debug information */
		_DBG_ ("ALARM 10s matched!");

		// Clear pending interrupt
		RTC_ClearIntPending(LPC_RTC, RTC_INT_ALARM);
	}
}
コード例 #2
0
ファイル: rtc.cpp プロジェクト: webgou/Equinox-Clock
extern "C" void RTC_IRQHandler(void){
//	RTC_ClearIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE);
//	secondlyCheck();
//	return;
	uint32_t secval;
	// This is increment counter interrupt
	if (RTC_GetIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE)){
		// Clear pending interrupt
		RTC_ClearIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE);
		_60th_SEC_COUNT=0;
		time2.second_inc=1;
		//run  checks at xx:xx:00
		if(!GetSS()){
			//run  checks at xx:00:00
			if(!GetMM()){
				//run daily checks at 00:00:00
				if(!GetHH()){
					//run weekly checks at Mon 00:00:00
					if(1 == GetDOW()){
						//run weekly checks at 1st Mon 00:00:00
						if(1 == GetDOM()){
							//run weekly checks at Jan 1st Mon 00:00:00
							if(1 == GetM()){
								yearlyCheck();
							}
							monthlyCheck();
						}
						weeklyCheck();
					}
					dailyCheck();
				}
				hourlyCheck();
			}
			minutelyCheck();
		}
		secondlyCheck();
	}

	// Continue to check the Alarm match
	if (RTC_GetIntPending(LPC_RTC, RTC_INT_ALARM)){
		// Clear pending interrupt
		RTC_ClearIntPending(LPC_RTC, RTC_INT_ALARM);
		set_next_alarm();
		sort_alarms();
		/* Send debug information */
//		_DBG_ ("ALARM 10s matched!");
	}
}
コード例 #3
0
// Rutina de interrupción del RTC
void RTC_IRQHandler(void) {
	static signed portBASE_TYPE param;
	uint32_t sec;

	// Verifica que haya una interrupción pendiente por incremento en el RTC
	if (RTC_GetIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE)) {

		// Limpia la interrupción pendiente
		RTC_ClearIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE);

		sec = RTC_GetTime(LPC_RTC, RTC_TIMETYPE_SECOND);
		sumarSegundo();

		//if (!(sec % INTERVALO_SEG)) {		// PARA HACER CADA INTERVALOS DE MENOS DE UN MIN - REVISAR BIEN CÓDIGO

		if (sec == 40) {
			deshabilitar_int_rotativo();
		} else if (sec == 50) {
			param = pdFALSE;
			xSemaphoreGiveFromISR(sem_calcula_temp, &param);// Libera semáforo
			// En param se guardará pdTRUE si la liberación del semáforo desbloqueó una tarea
			// y si esta tarea es de mayor prioridad a la tarea running actual.
			portYIELD_FROM_ISR(param);// Si param=pdTRUE, se fuerza a un cambio de contexto

			//printf("Cant: %d \n",timer0_cant);
			//timer0_cant=0;

		} else if (sec == 59) {
			habilitar_int_rotativo();
		}
	}

}
コード例 #4
0
ファイル: rtc_deeppwd.c プロジェクト: m3y54m/32bitmicro
/*********************************************************************//**
 * @brief		RTC(Real-time clock) interrupt handler
 * @param[in]	none
 * @return 		None
 **********************************************************************/
void RTC_IRQHandler(void)
{
	if(RTC_GetIntPending(LPC_RTC, RTC_INT_ALARM))
	{
		RTC_ClearIntPending(LPC_RTC, RTC_INT_ALARM);
		RTC_Cmd(LPC_RTC, DISABLE);
		NVIC_DisableIRQ(RTC_IRQn);
	}
}
コード例 #5
0
/*********************************************************************//**
 * @brief       RTC interrupt handler sub-routine
 * @param[in]   None
 * @return      None
 **********************************************************************/
void RTC_IRQHandler(void)
{
    /* This is increment counter interrupt*/
    if (RTC_GetIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE))
    {
        secval = RTC_GetTime (LPC_RTC, RTC_TIMETYPE_SECOND);

        // Clear pending interrupt
        RTC_ClearIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE);
    }
}
コード例 #6
0
ファイル: rtc_deeppwd.c プロジェクト: m3y54m/32bitmicro
/*********************************************************************//**
 * @brief		c_entry: Main program body
 * @param[in]	None
 * @return 		int
 **********************************************************************/
int c_entry (void)
{

	/* Initialize debug via UART0
	 * – 115200bps
	 * – 8 data bit
	 * – No parity
	 * – 1 stop bit
	 * – No flow control
	 */
	debug_frmwrk_init();

	// print welcome screen
	print_menu();

	/* Initialize and configure RTC */
	RTC_Init(LPC_RTC);

	RTC_ResetClockTickCounter(LPC_RTC);
	RTC_SetTime (LPC_RTC, RTC_TIMETYPE_SECOND, 0);

	/* Set alarm time = 5s.
	 * So, after each 5s, RTC will generate and wake-up system
	 * out of Deep PowerDown mode.
	 */
	RTC_SetAlarmTime (LPC_RTC, RTC_TIMETYPE_SECOND, 5);

	RTC_CntIncrIntConfig (LPC_RTC, RTC_TIMETYPE_SECOND, DISABLE);
	/* Set the AMR for 5s match alarm interrupt */
	RTC_AlarmIntConfig (LPC_RTC, RTC_TIMETYPE_SECOND, ENABLE);
	RTC_ClearIntPending(LPC_RTC, RTC_INT_ALARM);

	_DBG_("Press '1' to enter system in Deep PowerDown mode");
	while(_DG !='1');

	RTC_Cmd(LPC_RTC, ENABLE);
	NVIC_EnableIRQ(RTC_IRQn);

	_DBG_("Enter Deep PowerDown mode...");
	_DBG_("Wait 5s, RTC will wake-up system...\n\r");

	// Enter target power down mode
	CLKPWR_DeepPowerDown();

	while(1);
	return 1;
}
コード例 #7
0
// Inicializa módulo RTC
void rtc_init(void) {

	RTC_Init(LPC_RTC);
	CLKPWR_ConfigPPWR(CLKPWR_PCONP_PCRTC, ENABLE);

	// Configura RTC para interrumpir cada 1 segundo
	RTC_CntIncrIntConfig(LPC_RTC, RTC_TIMETYPE_SECOND, ENABLE);

	// Limpia las interrupciones del RTC
	RTC_ClearIntPending(LPC_RTC, RTC_INT_COUNTER_INCREASE);

	// Habilita las interrupciones del RTC en NVIC
	NVIC_EnableIRQ((IRQn_Type) RTC_IRQn);

	// Habilita el módulo RTC --> comienza a contar el tiempo
	RTC_Cmd(LPC_RTC, ENABLE);

	NVIC_SetPriority((IRQn_Type) RTC_IRQn, 6);
}