apm32f10x_rtc.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*!
  2. * @file apm32f10x_rtc.h
  3. *
  4. * @brief This file contains all the functions prototypes for the RTC firmware library
  5. *
  6. * @version V1.0.1
  7. *
  8. * @date 2021-03-23
  9. *
  10. */
  11. #ifndef __APM32F10X_RTC_H
  12. #define __APM32F10X_RTC_H
  13. #include "apm32f10x.h"
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /** @addtogroup Peripherals_Library Standard Peripheral Library
  18. @{
  19. */
  20. /** @addtogroup RTC_Driver RTC Driver
  21. @{
  22. */
  23. /** @addtogroup RTC_Enumerations Enumerations
  24. @{
  25. */
  26. typedef enum
  27. {
  28. RTC_FLAG_OC = 0x0020, //!< RTC Operation Complete flag
  29. RTC_FLAG_RSYNC = 0x0008, //!< Registers Synchronized flag
  30. RTC_FLAG_OVR = 0x0004, //!< Overflow flag
  31. RTC_FLAG_ALR = 0x0002, //!< Alarm flag
  32. RTC_FLAG_SEC = 0x0001 //!< Second flag
  33. } RTC_FLAG_T;
  34. typedef enum
  35. {
  36. RTC_INT_OVR = 0x0004, //!< Overflow interrupt
  37. RTC_INT_ALR = 0x0002, //!< Alarm interrupt
  38. RTC_INT_SEC = 0x0001 //!< Second interrupt
  39. } RTC_INT_T;
  40. /**@} end of group RTC_Enumerations*/
  41. /** @addtogroup RTC_Fuctions Fuctions
  42. @{
  43. */
  44. /** Operation modes */
  45. void RTC_EnableConfigMode(void);
  46. void RTC_DisableConfigMode(void);
  47. /** Configuration */
  48. uint32_t RTC_ReadCounter(void);
  49. void RTC_ConfigCounter(uint32_t value);
  50. void RTC_ConfigPrescaler(uint32_t value);
  51. void RTC_ConfigAlarm(uint32_t value);
  52. uint32_t RTC_ReadDivider(void);
  53. void RTC_WaitForLastTask(void);
  54. void RTC_WaitForSynchor(void);
  55. /** Interrupts and flags */
  56. void RTC_EnableInterrupt(uint16_t interrupt);
  57. void RTC_DisableInterrupt(uint16_t interrupt);
  58. uint8_t RTC_ReadStatusFlag(RTC_FLAG_T flag);
  59. void RTC_ClearStatusFlag(uint16_t flag);
  60. uint8_t RTC_ReadIntFlag(RTC_INT_T flag);
  61. void RTC_ClearIntFlag(uint16_t flag);
  62. /**@} end of group RTC_Fuctions*/
  63. /**@} end of group RTC_Driver*/
  64. /**@} end of group Peripherals_Library*/
  65. #ifdef __cplusplus
  66. }
  67. #endif
  68. #endif /* __APM32F10X_RTC_H */