stm32f10x_rtc.h 3.7 KB

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