em_rtc.h

Go to the documentation of this file.
00001 /***************************************************************************/
00034 #ifndef __EM_RTC_H
00035 #define __EM_RTC_H
00036 
00037 #include "em_device.h"
00038 #if defined(RTC_COUNT) && (RTC_COUNT > 0)
00039 
00040 #include <stdbool.h>
00041 
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045 
00046 /***************************************************************************/
00051 /***************************************************************************/
00056 /*******************************************************************************
00057  *******************************   STRUCTS   ***********************************
00058  ******************************************************************************/
00059 
00061 typedef struct
00062 {
00063   bool enable;   
00064   bool debugRun; 
00065   bool comp0Top; 
00066 } RTC_Init_TypeDef;
00067 
00069 #define RTC_INIT_DEFAULT                                       \
00070   { true,    /* Start counting when init done */               \
00071     false,   /* Disable updating during debug halt */          \
00072     true     /* Restart counting from 0 when reaching COMP0 */ \
00073   }
00074 
00075 
00076 /*******************************************************************************
00077  *****************************   PROTOTYPES   **********************************
00078  ******************************************************************************/
00079 
00080 uint32_t RTC_CompareGet(unsigned int comp);
00081 void RTC_CompareSet(unsigned int comp, uint32_t value);
00082 
00083 /***************************************************************************/
00090 __STATIC_INLINE uint32_t RTC_CounterGet(void)
00091 {
00092   return(RTC->CNT);
00093 }
00094 
00095 void RTC_CounterReset(void);
00096 void RTC_Enable(bool enable);
00097 void RTC_FreezeEnable(bool enable);
00098 void RTC_Init(const RTC_Init_TypeDef *init);
00099 
00100 /***************************************************************************/
00109 __STATIC_INLINE void RTC_IntClear(uint32_t flags)
00110 {
00111   RTC->IFC = flags;
00112 }
00113 
00114 
00115 /***************************************************************************/
00124 __STATIC_INLINE void RTC_IntDisable(uint32_t flags)
00125 {
00126   RTC->IEN &= ~(flags);
00127 }
00128 
00129 
00130 /***************************************************************************/
00144 __STATIC_INLINE void RTC_IntEnable(uint32_t flags)
00145 {
00146   RTC->IEN |= flags;
00147 }
00148 
00149 
00150 /***************************************************************************/
00161 __STATIC_INLINE uint32_t RTC_IntGet(void)
00162 {
00163   return(RTC->IF);
00164 }
00165 
00166 
00167 /***************************************************************************/
00176 __STATIC_INLINE void RTC_IntSet(uint32_t flags)
00177 {
00178   RTC->IFS = flags;
00179 }
00180 
00181 void RTC_Reset(void);
00182 
00186 #ifdef __cplusplus
00187 }
00188 #endif
00189 
00190 #endif /* defined(RTC_COUNT) && (RTC_COUNT > 0) */
00191 #endif /* __EM_RTC_H */