gd32f10x_rtc.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /**
  2. ******************************************************************************
  3. * @brief RTC header file of the firmware library.
  4. ******************************************************************************
  5. */
  6. /* Define to prevent recursive inclusion -------------------------------------*/
  7. #ifndef __GD32F10X_RTC_H
  8. #define __GD32F10X_RTC_H
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. /* Includes ------------------------------------------------------------------*/
  13. #include "gd32f10x.h"
  14. /** @addtogroup GD32F10x_Firmware
  15. * @{
  16. */
  17. /** @addtogroup RTC
  18. * @{
  19. */
  20. /** @defgroup RTC_Exported_Defines
  21. * @{
  22. */
  23. /** @defgroup RTC_Interrupt_Def
  24. * @{
  25. */
  26. #define RTC_INT_OVF ((uint16_t)0x0004) /*!< Overflow interrupt */
  27. #define RTC_INT_AF ((uint16_t)0x0002) /*!< Alarm interrupt */
  28. #define RTC_INT_SF ((uint16_t)0x0001) /*!< Second interrupt */
  29. /**
  30. * @}
  31. */
  32. /** @defgroup RTC_Interrupts_Flags
  33. * @{
  34. */
  35. #define RTC_FLAG_LWOFF ((uint16_t)0x0020) /*!< Last write operation finished flag */
  36. #define RTC_FLAG_RSF ((uint16_t)0x0008) /*!< Registers Synchronized flag */
  37. #define RTC_FLAG_OVF ((uint16_t)0x0004) /*!< Overflow flag */
  38. #define RTC_FLAG_AF ((uint16_t)0x0002) /*!< Alarm flag */
  39. #define RTC_FLAG_SF ((uint16_t)0x0001) /*!< Second flag */
  40. /**
  41. * @}
  42. */
  43. /**
  44. * @}
  45. */
  46. /** @defgroup RTC_Exported_Functions
  47. * @{
  48. */
  49. void RTC_INT_Enable(uint16_t RTC_int, TypeState NewValue);
  50. void RTC_EnterConfigMode(void);
  51. void RTC_ExitConfigMode(void);
  52. uint32_t RTC_GetCounter(void);
  53. void RTC_SetCounter(uint32_t CounterValue);
  54. void RTC_SetPrescaler(uint32_t PrescalerValue);
  55. void RTC_SetAlarm(uint32_t AlarmTime);
  56. uint32_t RTC_GetDividerValue(void);
  57. void RTC_WaitLWOFF(void);
  58. void RTC_WaitRSF(void);
  59. TypeState RTC_GetBitState(uint16_t RTC_flag);
  60. void RTC_ClearBitState(uint16_t RTC_flag);
  61. TypeState RTC_GetIntBitState(uint16_t RTC_INT);
  62. void RTC_ClearIntBitState(uint16_t RTC_INT);
  63. /**
  64. * @}
  65. */
  66. #ifdef __cplusplus
  67. }
  68. #endif
  69. #endif /*__GD32F10X_RTC_H */
  70. /**
  71. * @}
  72. */
  73. /**
  74. * @}
  75. */