stm32f10x_rtc.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /**
  2. ******************************************************************************
  3. * @file stm32f10x_rtc.h
  4. * @author MCD Application Team
  5. * @version V3.5.0
  6. * @date 11-March-2011
  7. * @brief This file contains all the functions prototypes for the RTC firmware
  8. * library.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  13. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  14. * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  15. * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  16. * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  17. * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  18. *
  19. * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
  20. ******************************************************************************
  21. */
  22. /* Define to prevent recursive inclusion -------------------------------------*/
  23. #ifndef __STM32F10x_RTC_H
  24. #define __STM32F10x_RTC_H
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. /* Includes ------------------------------------------------------------------*/
  29. #include "stm32f10x.h"
  30. /** @addtogroup STM32F10x_StdPeriph_Driver
  31. * @{
  32. */
  33. /** @addtogroup RTC
  34. * @{
  35. */
  36. /** @defgroup RTC_Exported_Types
  37. * @{
  38. */
  39. /**
  40. * @}
  41. */
  42. /** @defgroup RTC_Exported_Constants
  43. * @{
  44. */
  45. /** @defgroup RTC_interrupts_define
  46. * @{
  47. */
  48. #define RTC_IT_OW ((uint16_t)0x0004) /*!< Overflow interrupt */
  49. #define RTC_IT_ALR ((uint16_t)0x0002) /*!< Alarm interrupt */
  50. #define RTC_IT_SEC ((uint16_t)0x0001) /*!< Second interrupt */
  51. #define IS_RTC_IT(IT) ((((IT) & (uint16_t)0xFFF8) == 0x00) && ((IT) != 0x00))
  52. #define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_OW) || ((IT) == RTC_IT_ALR) || \
  53. ((IT) == RTC_IT_SEC))
  54. /**
  55. * @}
  56. */
  57. /** @defgroup RTC_interrupts_flags
  58. * @{
  59. */
  60. #define RTC_FLAG_RTOFF ((uint16_t)0x0020) /*!< RTC Operation OFF flag */
  61. #define RTC_FLAG_RSF ((uint16_t)0x0008) /*!< Registers Synchronized flag */
  62. #define RTC_FLAG_OW ((uint16_t)0x0004) /*!< Overflow flag */
  63. #define RTC_FLAG_ALR ((uint16_t)0x0002) /*!< Alarm flag */
  64. #define RTC_FLAG_SEC ((uint16_t)0x0001) /*!< Second flag */
  65. #define IS_RTC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFF0) == 0x00) && ((FLAG) != 0x00))
  66. #define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_RTOFF) || ((FLAG) == RTC_FLAG_RSF) || \
  67. ((FLAG) == RTC_FLAG_OW) || ((FLAG) == RTC_FLAG_ALR) || \
  68. ((FLAG) == RTC_FLAG_SEC))
  69. #define IS_RTC_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFFFF)
  70. /**
  71. * @}
  72. */
  73. /**
  74. * @}
  75. */
  76. /** @defgroup RTC_Exported_Macros
  77. * @{
  78. */
  79. /**
  80. * @}
  81. */
  82. /** @defgroup RTC_Exported_Functions
  83. * @{
  84. */
  85. void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState);
  86. void RTC_EnterConfigMode(void);
  87. void RTC_ExitConfigMode(void);
  88. uint32_t RTC_GetCounter(void);
  89. void RTC_SetCounter(uint32_t CounterValue);
  90. void RTC_SetPrescaler(uint32_t PrescalerValue);
  91. void RTC_SetAlarm(uint32_t AlarmValue);
  92. uint32_t RTC_GetDivider(void);
  93. void RTC_WaitForLastTask(void);
  94. void RTC_WaitForSynchro(void);
  95. FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG);
  96. void RTC_ClearFlag(uint16_t RTC_FLAG);
  97. ITStatus RTC_GetITStatus(uint16_t RTC_IT);
  98. void RTC_ClearITPendingBit(uint16_t RTC_IT);
  99. #ifdef __cplusplus
  100. }
  101. #endif
  102. #endif /* __STM32F10x_RTC_H */
  103. /**
  104. * @}
  105. */
  106. /**
  107. * @}
  108. */
  109. /**
  110. * @}
  111. */
  112. /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/