apm32f10x_rtc.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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.2
  7. *
  8. * @date 2022-01-05
  9. *
  10. * @attention
  11. *
  12. * Copyright (C) 2020-2022 Geehy Semiconductor
  13. *
  14. * You may not use this file except in compliance with the
  15. * GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
  16. *
  17. * The program is only for reference, which is distributed in the hope
  18. * that it will be usefull and instructional for customers to develop
  19. * their software. Unless required by applicable law or agreed to in
  20. * writing, the program is distributed on an "AS IS" BASIS, WITHOUT
  21. * ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
  23. * and limitations under the License.
  24. */
  25. #ifndef __APM32F10X_RTC_H
  26. #define __APM32F10X_RTC_H
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. #include "apm32f10x.h"
  31. /** @addtogroup Peripherals_Library Standard Peripheral Library
  32. @{
  33. */
  34. /** @addtogroup RTC_Driver RTC Driver
  35. @{
  36. */
  37. /** @addtogroup RTC_Enumerations Enumerations
  38. @{
  39. */
  40. typedef enum
  41. {
  42. RTC_FLAG_OC = 0x0020, //!< RTC Operation Complete flag
  43. RTC_FLAG_RSYNC = 0x0008, //!< Registers Synchronized flag
  44. RTC_FLAG_OVR = 0x0004, //!< Overflow flag
  45. RTC_FLAG_ALR = 0x0002, //!< Alarm flag
  46. RTC_FLAG_SEC = 0x0001 //!< Second flag
  47. } RTC_FLAG_T;
  48. typedef enum
  49. {
  50. RTC_INT_OVR = 0x0004, //!< Overflow interrupt
  51. RTC_INT_ALR = 0x0002, //!< Alarm interrupt
  52. RTC_INT_SEC = 0x0001 //!< Second interrupt
  53. } RTC_INT_T;
  54. /**@} end of group RTC_Enumerations*/
  55. /** @addtogroup RTC_Fuctions Fuctions
  56. @{
  57. */
  58. /** Operation modes */
  59. void RTC_EnableConfigMode(void);
  60. void RTC_DisableConfigMode(void);
  61. /** Configuration */
  62. uint32_t RTC_ReadCounter(void);
  63. void RTC_ConfigCounter(uint32_t value);
  64. void RTC_ConfigPrescaler(uint32_t value);
  65. void RTC_ConfigAlarm(uint32_t value);
  66. uint32_t RTC_ReadDivider(void);
  67. void RTC_WaitForLastTask(void);
  68. void RTC_WaitForSynchor(void);
  69. /** Interrupts and flags */
  70. void RTC_EnableInterrupt(uint16_t interrupt);
  71. void RTC_DisableInterrupt(uint16_t interrupt);
  72. uint8_t RTC_ReadStatusFlag(RTC_FLAG_T flag);
  73. void RTC_ClearStatusFlag(uint16_t flag);
  74. uint8_t RTC_ReadIntFlag(RTC_INT_T flag);
  75. void RTC_ClearIntFlag(uint16_t flag);
  76. /**@} end of group RTC_Fuctions*/
  77. /**@} end of group RTC_Driver*/
  78. /**@} end of group Peripherals_Library*/
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82. #endif /* __APM32F10X_RTC_H */