Ejemplo n.º 1
0
/* Star button long press callback. */
static void star_long_pressed()
{
	/* stop the hardware RTC */
	rtca_stop();

#ifdef CONFIG_MOD_CLOCK_BLINKCOL
	/* the blinking dots feature might hide the two dots, we display them
	  here just in case */
	display_symbol(0, LCD_SEG_L1_COL, SEG_ON);
#endif

	menu_editmode_start(&edit_save, edit_items);
}
Ejemplo n.º 2
0
void rtca_set_time()
{
	/* Stop RTC timekeeping for a while */
	rtca_stop();

	/* update RTC registers */
	RTCSEC = rtca_time.sec;
	RTCMIN = rtca_time.min;
	RTCHOUR = rtca_time.hour;

	/* Resume RTC time keeping */
	rtca_start();
}
Ejemplo n.º 3
0
void rtca_set_time()
{
    /* Stop RTC timekeeping for a while */
    rtca_stop();

    /* update RTC registers */
    RTCSEC = rtca_time.sec;
    RTCMIN = rtca_time.min;
    RTCHOUR = rtca_time.hour;
    RTCDAY = rtca_time.day;
    RTCDOW = rtca_time.dow;
    RTCMON = rtca_time.mon;
    RTCYEARL = rtca_time.year & 0xff;
    RTCYEARH = rtca_time.year >> 8;

    /* Resume RTC time keeping */
    rtca_start();
}
Ejemplo n.º 4
0
void rtca_set_date()
{
	/* Stop RTC timekeeping for a while */
	rtca_stop();

	rtca_update_dow();

	/* update RTC registers and local cache */
	RTCDAY = rtca_time.day;
	RTCDOW = rtca_time.dow;
	RTCMON = rtca_time.mon;
	RTCYEARL = rtca_time.year & 0xff;
	RTCYEARH = rtca_time.year >> 8;

	/* Resume RTC time keeping */
	rtca_start();

#ifdef CONFIG_RTC_DST
	/* calculate new DST switch dates */
	rtc_dst_calculate_dates(rtca_time.year, rtca_time.mon, rtca_time.day, rtca_time.hour);
#endif
}
Ejemplo n.º 5
0
void rtca_set_date()
{
	uint8_t dow;

	/* Stop RTC timekeeping for a while */
	rtca_stop();

	dow = LEAPS_SINCE_YEAR(rtca_time.year);

	if ((29 == rtca_get_max_days(2, rtca_time.year)) && (rtca_time.mon < 3))
		dow--; /* if this is a leap year but before February 29 */

	/* add day of current month */
	dow += rtca_time.day;

	/* add this month's dow value */
	switch (rtca_time.mon) {
	case 5:
		dow += 1;
		break;

	case 8:
		dow += 2;
		break;

	case 2:
	case 3:
	case 11:
		dow += 3;
		break;

	case 6:
		dow += 4;
		break;

	case 9:
	case 12:
		dow += 5;
		break;

	case 4:
	case 7:
		dow += 6;
		break;
	}

	dow = dow % 7;

	/* update RTC registers and local cache */
	RTCDAY = rtca_time.day;
	RTCDOW = (rtca_time.dow = dow);
	RTCMON = rtca_time.mon;
	RTCYEARL = rtca_time.year & 0xff;
	RTCYEARH = rtca_time.year >> 8;

	/* Resume RTC time keeping */
	rtca_start();

#ifdef CONFIG_RTC_DST
	/* calculate new DST switch dates */
	rtc_dst_calculate_dates(rtca_time.year, rtca_time.mon, rtca_time.day, rtca_time.hour);
#endif
}