1 //////////////////////////////////////////////////////////////////////////////// 2 /// @file hal_rtc.h 3 /// @author AE TEAM 4 /// @brief THIS FILE CONTAINS ALL THE FUNCTIONS PROTOTYPES FOR THE RTC 5 /// FIRMWARE LIBRARY. 6 //////////////////////////////////////////////////////////////////////////////// 7 /// @attention 8 /// 9 /// THE EXISTING FIRMWARE IS ONLY FOR REFERENCE, WHICH IS DESIGNED TO PROVIDE 10 /// CUSTOMERS WITH CODING INFORMATION ABOUT THEIR PRODUCTS SO THEY CAN SAVE 11 /// TIME. THEREFORE, MINDMOTION SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT OR 12 /// CONSEQUENTIAL DAMAGES ABOUT ANY CLAIMS ARISING OUT OF THE CONTENT OF SUCH 13 /// HARDWARE AND/OR THE USE OF THE CODING INFORMATION CONTAINED HEREIN IN 14 /// CONNECTION WITH PRODUCTS MADE BY CUSTOMERS. 15 /// 16 /// <H2><CENTER>© COPYRIGHT MINDMOTION </CENTER></H2> 17 //////////////////////////////////////////////////////////////////////////////// 18 19 // Define to prevent recursive inclusion 20 #ifndef __HAL_RTC_H 21 #define __HAL_RTC_H 22 23 // Files includes 24 #include "types.h" 25 #include "reg_common.h" 26 #include "reg_rtc.h" 27 28 //////////////////////////////////////////////////////////////////////////////// 29 /// @addtogroup MM32_Hardware_Abstract_Layer 30 /// @{ 31 32 //////////////////////////////////////////////////////////////////////////////// 33 /// @defgroup RTC_HAL 34 /// @brief RTC HAL modules 35 /// @{ 36 37 //////////////////////////////////////////////////////////////////////////////// 38 /// @defgroup RTC_Exported_Types 39 /// @{ 40 41 //////////////////////////////////////////////////////////////////////////////// 42 /// @brief RTC_interrupts_define 43 //////////////////////////////////////////////////////////////////////////////// 44 typedef enum { 45 RTC_IT_OW = RTC_CR_OWIE, ///< Overflow interrupt 46 RTC_IT_ALR = RTC_CR_ALRIE, ///< Alarm interrupt 47 RTC_IT_SEC = RTC_CR_SECIE ///< Second interrupt 48 } RTC_IT_TypeDef; 49 50 //////////////////////////////////////////////////////////////////////////////// 51 /// @brief RTC_interrupts_flags 52 //////////////////////////////////////////////////////////////////////////////// 53 typedef enum { 54 RTC_FLAG_RTOFF = RTC_CSR_RTOFF, ///< RTC Operation OFF flag 55 RTC_FLAG_RSF = RTC_CSR_RSF, ///< Registers Synchronized flag 56 RTC_FLAG_OW = RTC_CSR_OWF, ///< Overflow flag 57 RTC_FLAG_ALR = RTC_CSR_ALRF, ///< Alarm flag 58 RTC_FLAG_SEC = RTC_CSR_SECF ///< Second flag 59 } RTC_FLAG_TypeDef; 60 /// @} 61 62 //////////////////////////////////////////////////////////////////////////////// 63 /// @defgroup RTC_Exported_Constants 64 /// @{ 65 66 /// @} 67 68 //////////////////////////////////////////////////////////////////////////////// 69 /// @defgroup RTC_Exported_Variables 70 /// @{ 71 72 #ifdef _HAL_RTC_C_ 73 74 #define GLOBAL 75 #else 76 #define GLOBAL extern 77 #endif 78 79 GLOBAL bool accessRTC; 80 81 82 #undef GLOBAL 83 84 /// @} 85 86 //////////////////////////////////////////////////////////////////////////////// 87 /// @defgroup RTC_Exported_Functions 88 /// @{ 89 void RTC_ITConfig(RTC_IT_TypeDef it, FunctionalState state); 90 void RTC_ClearFlag(RTC_FLAG_TypeDef flag); 91 void RTC_ClearITPendingBit(RTC_IT_TypeDef it); 92 void RTC_EnterConfigMode(void); 93 void RTC_SetCounter(u32 count); 94 void RTC_SetPrescaler(u32 prescaler); 95 void RTC_SetAlarm(u32 alarm); 96 void RTC_ExitConfigMode(void); 97 void RTC_WaitForLastTask(void); 98 void RTC_WaitForSynchro(void); 99 100 u32 RTC_GetCounter(void); 101 u32 RTC_GetDivider(void); 102 103 FlagStatus RTC_GetFlagStatus(RTC_FLAG_TypeDef flag); 104 ITStatus RTC_GetITStatus(RTC_IT_TypeDef it); 105 106 /// @} 107 108 /// @} 109 110 /// @} 111 112 //////////////////////////////////////////////////////////////////////////////// 113 #endif // __HAL_RTC_H 114 //////////////////////////////////////////////////////////////////////////////// 115