Microchip® Advanced Software Framework

rtc.c File Reference

AVR XMEGA Real Time Counter driver.

Copyright (c) 2010-2018 Microchip Technology Inc. and its subsidiaries.

#include <compiler.h>
#include <sysclk.h>
#include <sleepmgr.h>
#include <rtc.h>

Data Structures

struct  rtc_data_struct
 Driver private struct. More...
 

Macros

#define RTC_COMPARE_INT_LEVEL   RTC_COMPINTLVL_LO_gc
 
#define RTC_OVERFLOW_INT_LEVEL   RTC_OVFINTLVL_LO_gc
 

Functions

 ISR (RTC_OVF_vect)
 Overflow interrupt handling high counter. More...
 
 ISR (RTC_COMP_vect)
 Compare interrupt used for alarm. More...
 
__always_inline bool rtc_alarm_has_triggered (void)
 Check if pending alarm have triggered. More...
 
uint32_t rtc_get_time (void)
 Get current time. More...
 
void rtc_init (void)
 Initialize the RTC. More...
 
__always_inline bool rtc_is_busy (void)
 Check if RTC is busy synchronizing. More...
 
void rtc_set_alarm (uint32_t time)
 Set alarm time. More...
 
void rtc_set_callback (rtc_callback_t callback)
 Set callback to call on alarm. More...
 
void rtc_set_time (uint32_t time)
 Set current time. More...
 

Variables

struct rtc_data_struct rtc_data
 Driver private data. More...
 

#define RTC_COMPARE_INT_LEVEL   RTC_COMPINTLVL_LO_gc

Referenced by rtc_set_alarm().

#define RTC_OVERFLOW_INT_LEVEL   RTC_OVFINTLVL_LO_gc

Referenced by ISR(), rtc_init(), and rtc_set_alarm().

ISR ( RTC_OVF_vect  )

Overflow interrupt handling high counter.

References rtc_data_struct::counter_high, and rtc_data.

__always_inline bool rtc_is_busy ( void  )

Check if RTC is busy synchronizing.

Referenced by rtc_get_time(), rtc_set_alarm(), and rtc_set_time().

struct rtc_data_struct rtc_data

Driver private data.