Exemplo n.º 1
0
//! [initiate]
void configure_rtc_calendar(void)
{
	/* Initialize RTC in calendar mode. */
//! [set_conf]
	struct rtc_calendar_config config_rtc_calendar;
//! [set_conf]
//! [get_default]
	rtc_calendar_get_config_defaults(&config_rtc_calendar);
//! [get_default]

//! [time_struct]
	struct rtc_calendar_time alarm;
	rtc_calendar_get_time_defaults(&alarm);
	alarm.year   = 2013;
	alarm.month  = 1;
	alarm.day    = 1;
	alarm.hour   = 0;
	alarm.minute = 0;
	alarm.second = 4;
//! [time_struct]

//! [set_config]
	config_rtc_calendar.clock_24h     = true;
	config_rtc_calendar.alarm[0].time = alarm;
	config_rtc_calendar.alarm[0].mask = RTC_CALENDAR_ALARM_MASK_YEAR;
//! [set_config]

//! [init_rtc]
	rtc_calendar_init(&rtc_instance, RTC, &config_rtc_calendar);
//! [init_rtc]

//! [enable]
	rtc_calendar_enable(&rtc_instance);
//! [enable]
}
Exemplo n.º 2
0
Arquivo: diskio.c Projeto: gstroe/Arm
static void configure_rtc_calendar(void)
{
	/* Initialize RTC in calendar mode. */
	struct rtc_calendar_config config_rtc_calendar;

	rtc_calendar_get_config_defaults(&config_rtc_calendar);

	struct rtc_calendar_time init_time;
	rtc_calendar_get_time_defaults(&init_time);
	init_time.year   = 2014;
	init_time.month  = 1;
	init_time.day    = 1;
	init_time.hour   = 0;
	init_time.minute = 0;
	init_time.second = 4;

	config_rtc_calendar.clock_24h     = true;
	config_rtc_calendar.alarm[0].time = init_time;
	config_rtc_calendar.alarm[0].mask = RTC_CALENDAR_ALARM_MASK_YEAR;

	rtc_calendar_init(&rtc_instance, RTC, &config_rtc_calendar);

	rtc_calendar_enable(&rtc_instance);
}