AVR1631 - Energy Meter Reference Design with ATxmega32A4  Rev 1.0
 All Data Structures Files Functions Variables Typedefs Macros
rtc_driver.h
Go to the documentation of this file.
1 /* This file has been prepared for Doxygen automatic documentation generation.*/
59 #ifndef RTC_DRIVER_H
60 #define RTC_DRIVER_H
61 
62 #include "avr_compiler.h"
63 
64 /* Definitions of macros. */
65 
70 #define RTC_Busy() ( RTC.STATUS & RTC_SYNCBUSY_bm )
71 
76 #define RTC_GetOverflowFlag() ( RTC.INTFLAGS & RTC_OVFIF_bm )
77 
82 #define RTC_GetCompareFlag() ( RTC.INTFLAGS & RTC_COMPIF_bm )
83 
93 #define RTC_SetCount( _rtccnt ) ( RTC.CNT = (_rtccnt) )
94 
101 #define RTC_GetCount() ( RTC.CNT )
102 
112 #define RTC_SetPeriod( _rtcper ) ( RTC.PER = (_rtcper) )
113 
120 #define RTC_GetPeriod() ( RTC.PER )
121 
132 #define RTC_SetCompareValue( _cmpVal ) ( RTC.COMP = (_cmpVal) )
133 
141 #define RTC_GetCompareValue() ( RTC.COMP )
142 
143 
144 /* Prototyping of functions. Documentation is found in source file. */
145 
146 void RTC_Initialize( uint16_t period,
147  uint16_t count,
148  uint16_t compareValue,
149  RTC_PRESCALER_t prescaler);
150 void RTC_SetOverflowIntLevel( RTC_OVFINTLVL_t intLevel );
151 void RTC_SetCompareIntLevel( RTC_COMPINTLVL_t intLevel );
152 void RTC_SetIntLevels( RTC_OVFINTLVL_t ovfIntLevel,
153  RTC_COMPINTLVL_t compIntLevel );
154 void RTC_SetAlarm( uint16_t alarmTimeout );
155 void RTC_SetPrescaler( RTC_PRESCALER_t prescaler );
156 
157 
172 #endif