1 /* Define to prevent recursive inclusion -------------------------------------*/ 2 #ifndef __AIR32F10x_RTC_H 3 #define __AIR32F10x_RTC_H 4 5 #ifdef __cplusplus 6 extern "C" { 7 #endif 8 9 /* Includes ------------------------------------------------------------------*/ 10 #include "air32f10x.h" 11 12 /** @addtogroup air32f10x_StdPeriph_Driver 13 * @{ 14 */ 15 16 /** @addtogroup RTC 17 * @{ 18 */ 19 20 /** @defgroup RTC_Exported_Types 21 * @{ 22 */ 23 24 /** 25 * @} 26 */ 27 28 /** @defgroup RTC_Exported_Constants 29 * @{ 30 */ 31 32 /** @defgroup RTC_interrupts_define 33 * @{ 34 */ 35 36 #define RTC_IT_OW ((uint16_t)0x0004) /*!< Overflow interrupt */ 37 #define RTC_IT_ALR ((uint16_t)0x0002) /*!< Alarm interrupt */ 38 #define RTC_IT_SEC ((uint16_t)0x0001) /*!< Second interrupt */ 39 #define IS_RTC_IT(IT) ((((IT) & (uint16_t)0xFFF8) == 0x00) && ((IT) != 0x00)) 40 #define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_OW) || ((IT) == RTC_IT_ALR) || \ 41 ((IT) == RTC_IT_SEC)) 42 /** 43 * @} 44 */ 45 46 /** @defgroup RTC_interrupts_flags 47 * @{ 48 */ 49 50 #define RTC_FLAG_RTOFF ((uint16_t)0x0020) /*!< RTC Operation OFF flag */ 51 #define RTC_FLAG_RSF ((uint16_t)0x0008) /*!< Registers Synchronized flag */ 52 #define RTC_FLAG_OW ((uint16_t)0x0004) /*!< Overflow flag */ 53 #define RTC_FLAG_ALR ((uint16_t)0x0002) /*!< Alarm flag */ 54 #define RTC_FLAG_SEC ((uint16_t)0x0001) /*!< Second flag */ 55 #define IS_RTC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFF0) == 0x00) && ((FLAG) != 0x00)) 56 #define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_RTOFF) || ((FLAG) == RTC_FLAG_RSF) || \ 57 ((FLAG) == RTC_FLAG_OW) || ((FLAG) == RTC_FLAG_ALR) || \ 58 ((FLAG) == RTC_FLAG_SEC)) 59 #define IS_RTC_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFFFF) 60 61 /** 62 * @} 63 */ 64 65 /** 66 * @} 67 */ 68 69 /** @defgroup RTC_Exported_Macros 70 * @{ 71 */ 72 73 /** 74 * @} 75 */ 76 77 /** @defgroup RTC_Exported_Functions 78 * @{ 79 */ 80 81 void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState); 82 void RTC_EnterConfigMode(void); 83 void RTC_ExitConfigMode(void); 84 uint32_t RTC_GetCounter(void); 85 void RTC_SetCounter(uint32_t CounterValue); 86 void RTC_SetPrescaler(uint32_t PrescalerValue); 87 void RTC_SetAlarm(uint32_t AlarmValue); 88 uint32_t RTC_GetDivider(void); 89 void RTC_WaitForLastTask(void); 90 void RTC_WaitForSynchro(void); 91 FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG); 92 void RTC_ClearFlag(uint16_t RTC_FLAG); 93 ITStatus RTC_GetITStatus(uint16_t RTC_IT); 94 void RTC_ClearITPendingBit(uint16_t RTC_IT); 95 96 #ifdef __cplusplus 97 } 98 #endif 99 100 #endif /* __AIR32F10x_RTC_H */ 101 /** 102 * @} 103 */ 104 105 /** 106 * @} 107 */ 108 109 /** 110 * @} 111 */ 112 113