hal_rtc.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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>&COPY; COPYRIGHT MINDMOTION </CENTER></H2>
  17. ////////////////////////////////////////////////////////////////////////////////
  18. // Define to prevent recursive inclusion
  19. #ifndef __HAL_RTC_H
  20. #define __HAL_RTC_H
  21. // Files includes
  22. #include "types.h"
  23. #include "reg_common.h"
  24. #include "reg_rtc.h"
  25. ////////////////////////////////////////////////////////////////////////////////
  26. /// @addtogroup MM32_Hardware_Abstract_Layer
  27. /// @{
  28. ////////////////////////////////////////////////////////////////////////////////
  29. /// @defgroup RTC_HAL
  30. /// @brief RTC HAL modules
  31. /// @{
  32. ////////////////////////////////////////////////////////////////////////////////
  33. /// @defgroup RTC_Exported_Types
  34. /// @{
  35. ////////////////////////////////////////////////////////////////////////////////
  36. /// @brief RTC_interrupts_define
  37. ////////////////////////////////////////////////////////////////////////////////
  38. typedef enum {
  39. RTC_IT_OW = RTC_CR_OWIE, ///< Overflow interrupt
  40. RTC_IT_ALR = RTC_CR_ALRIE, ///< Alarm interrupt
  41. RTC_IT_SEC = RTC_CR_SECIE ///< Second interrupt
  42. } RTC_IT_TypeDef;
  43. ////////////////////////////////////////////////////////////////////////////////
  44. /// @brief RTC_interrupts_flags
  45. ////////////////////////////////////////////////////////////////////////////////
  46. typedef enum {
  47. RTC_FLAG_RTOFF = RTC_CSR_RTOFF, ///< RTC Operation OFF flag
  48. RTC_FLAG_RSF = RTC_CSR_RSF, ///< Registers Synchronized flag
  49. RTC_FLAG_OW = RTC_CSR_OWF, ///< Overflow flag
  50. RTC_FLAG_ALR = RTC_CSR_ALRF, ///< Alarm flag
  51. RTC_FLAG_SEC = RTC_CSR_SECF ///< Second flag
  52. } RTC_FLAG_TypeDef;
  53. /// @}
  54. ////////////////////////////////////////////////////////////////////////////////
  55. /// @defgroup RTC_Exported_Constants
  56. /// @{
  57. /// @}
  58. ////////////////////////////////////////////////////////////////////////////////
  59. /// @defgroup RTC_Exported_Variables
  60. /// @{
  61. #ifdef _HAL_RTC_C_
  62. #define GLOBAL
  63. #else
  64. #define GLOBAL extern
  65. #endif
  66. GLOBAL bool accessRTC;
  67. #undef GLOBAL
  68. /// @}
  69. ////////////////////////////////////////////////////////////////////////////////
  70. /// @defgroup RTC_Exported_Functions
  71. /// @{
  72. void RTC_ITConfig(RTC_IT_TypeDef it, FunctionalState state);
  73. void RTC_ClearFlag(RTC_FLAG_TypeDef flag);
  74. void RTC_ClearITPendingBit(RTC_IT_TypeDef it);
  75. void RTC_EnterConfigMode(void);
  76. void RTC_SetCounter(u32 count);
  77. void RTC_SetPrescaler(u32 prescaler);
  78. void RTC_SetAlarm(u32 alarm);
  79. void RTC_ExitConfigMode(void);
  80. void RTC_WaitForLastTask(void);
  81. void RTC_WaitForSynchro(void);
  82. u32 RTC_GetCounter(void);
  83. u32 RTC_GetDivider(void);
  84. FlagStatus RTC_GetFlagStatus(RTC_FLAG_TypeDef flag);
  85. ITStatus RTC_GetITStatus(RTC_IT_TypeDef it);
  86. /// @}
  87. /// @}
  88. /// @}
  89. ////////////////////////////////////////////////////////////////////////////////
  90. #endif // __HAL_RTC_H
  91. ////////////////////////////////////////////////////////////////////////////////