A bundled STM32F10x Std Periph and CMSIS library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

stm32f10x_rtc.h 3.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. #include "stm32f10x_assert.h"
  31. /** @addtogroup STM32F10x_StdPeriph_Driver
  32. * @{
  33. */
  34. /** @addtogroup RTC
  35. * @{
  36. */
  37. /** @defgroup RTC_Exported_Types
  38. * @{
  39. */
  40. /**
  41. * @}
  42. */
  43. /** @defgroup RTC_Exported_Constants
  44. * @{
  45. */
  46. /** @defgroup RTC_interrupts_define
  47. * @{
  48. */
  49. #define RTC_IT_OW ((uint16_t)0x0004) /*!< Overflow interrupt */
  50. #define RTC_IT_ALR ((uint16_t)0x0002) /*!< Alarm interrupt */
  51. #define RTC_IT_SEC ((uint16_t)0x0001) /*!< Second interrupt */
  52. #define IS_RTC_IT(IT) ((((IT) & (uint16_t)0xFFF8) == 0x00) && ((IT) != 0x00))
  53. #define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_OW) || ((IT) == RTC_IT_ALR) || \
  54. ((IT) == RTC_IT_SEC))
  55. /**
  56. * @}
  57. */
  58. /** @defgroup RTC_interrupts_flags
  59. * @{
  60. */
  61. #define RTC_FLAG_RTOFF ((uint16_t)0x0020) /*!< RTC Operation OFF flag */
  62. #define RTC_FLAG_RSF ((uint16_t)0x0008) /*!< Registers Synchronized flag */
  63. #define RTC_FLAG_OW ((uint16_t)0x0004) /*!< Overflow flag */
  64. #define RTC_FLAG_ALR ((uint16_t)0x0002) /*!< Alarm flag */
  65. #define RTC_FLAG_SEC ((uint16_t)0x0001) /*!< Second flag */
  66. #define IS_RTC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFF0) == 0x00) && ((FLAG) != 0x00))
  67. #define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_RTOFF) || ((FLAG) == RTC_FLAG_RSF) || \
  68. ((FLAG) == RTC_FLAG_OW) || ((FLAG) == RTC_FLAG_ALR) || \
  69. ((FLAG) == RTC_FLAG_SEC))
  70. #define IS_RTC_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFFFF)
  71. /**
  72. * @}
  73. */
  74. /**
  75. * @}
  76. */
  77. /** @defgroup RTC_Exported_Macros
  78. * @{
  79. */
  80. /**
  81. * @}
  82. */
  83. /** @defgroup RTC_Exported_Functions
  84. * @{
  85. */
  86. void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState);
  87. void RTC_EnterConfigMode(void);
  88. void RTC_ExitConfigMode(void);
  89. uint32_t RTC_GetCounter(void);
  90. void RTC_SetCounter(uint32_t CounterValue);
  91. void RTC_SetPrescaler(uint32_t PrescalerValue);
  92. void RTC_SetAlarm(uint32_t AlarmValue);
  93. uint32_t RTC_GetDivider(void);
  94. void RTC_WaitForLastTask(void);
  95. void RTC_WaitForSynchro(void);
  96. FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG);
  97. void RTC_ClearFlag(uint16_t RTC_FLAG);
  98. ITStatus RTC_GetITStatus(uint16_t RTC_IT);
  99. void RTC_ClearITPendingBit(uint16_t RTC_IT);
  100. #ifdef __cplusplus
  101. }
  102. #endif
  103. #endif /* __STM32F10x_RTC_H */
  104. /**
  105. * @}
  106. */
  107. /**
  108. * @}
  109. */
  110. /**
  111. * @}
  112. */
  113. /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/