void RTC_Basic(void) { SystemInit(); UART_Configuration(UART); __disable_irq(); /* enable RTC interrupt */ NVIC_ClearPendingIRQ(INTRTC_IRQn); TSB_CG->IMCGF = CG_IMCGC_RTC_EDGE; TSB_CG->IMCGF = CG_IMCGC_RTC_INTEN; NVIC_EnableIRQ(INTRTC_IRQn); Date_Struct.LeapYear = RTC_LEAP_YEAR_2; Date_Struct.Year = (uint8_t) 10; Date_Struct.Month = (uint8_t) 12; Date_Struct.Date = (uint8_t) 31; Date_Struct.Day = RTC_FRI; Time_Struct.HourMode = RTC_12_HOUR_MODE; Time_Struct.Hour = (uint8_t) 11; Time_Struct.AmPm = RTC_PM_MODE; Time_Struct.Min = (uint8_t) 59; Time_Struct.Sec = (uint8_t) 50; RTC_DisableClock(); RTC_DisableAlarm(); /* Reset RTC sec counter */ RTC_ResetClockSec(); /* Set RTC Time value */ RTC_SetTimeValue(&Time_Struct); /* Set RTC Date value */ RTC_SetDateValue(&Date_Struct); /* Enable 1Hz interrupt */ RTC_SetAlarmOutput(RTC_PULSE_1_HZ); /* Enable RTCINT */ RTC_SetRTCINT(ENABLE); __enable_irq(); /* waiting for RTC register set finish */ while (fRTCSetting_ok != 1U) { /* Do nothing */ } fRTCSetting_ok = 0U; /* Enable RTC Clock function */ RTC_EnableClock(); while (1) { if (fRTCSetting_ok == 1U) { fRTCSetting_ok = 0U; demo0(); demo1(); } else { /* Do nothing */ } } }
/** * disable the power save feature: * disable OLED * disable current sensor subscriptions */ void power_DisablePowerSave() { isActive_powerSave = false; RTC_DisableAlarm(); }