apm32f10x_rtc.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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.4
  7. *
  8. * @date 2022-12-01
  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 useful 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. /* Define to prevent recursive inclusion */
  26. #ifndef __APM32F10X_RTC_H
  27. #define __APM32F10X_RTC_H
  28. /* Includes */
  29. #include "apm32f10x.h"
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /** @addtogroup APM32F10x_StdPeriphDriver
  34. @{
  35. */
  36. /** @addtogroup RTC_Driver RTC Driver
  37. @{
  38. */
  39. /** @defgroup RTC_Enumerations Enumerations
  40. @{
  41. */
  42. typedef enum
  43. {
  44. RTC_FLAG_OC = 0x0020, /*!< RTC Operation Complete flag */
  45. RTC_FLAG_RSYNC = 0x0008, /*!< Registers Synchronized flag */
  46. RTC_FLAG_OVR = 0x0004, /*!< Overflow flag */
  47. RTC_FLAG_ALR = 0x0002, /*!< Alarm flag */
  48. RTC_FLAG_SEC = 0x0001 /*!< Second flag */
  49. } RTC_FLAG_T;
  50. typedef enum
  51. {
  52. RTC_INT_OVR = 0x0004, /*!< Overflow interrupt */
  53. RTC_INT_ALR = 0x0002, /*!< Alarm interrupt */
  54. RTC_INT_SEC = 0x0001 /*!< Second interrupt */
  55. } RTC_INT_T;
  56. /**@} end of group RTC_Enumerations */
  57. /** @defgroup RTC_Functions Functions
  58. @{
  59. */
  60. /* Operation modes */
  61. void RTC_EnableConfigMode(void);
  62. void RTC_DisableConfigMode(void);
  63. /* Configuration */
  64. uint32_t RTC_ReadCounter(void);
  65. void RTC_ConfigCounter(uint32_t value);
  66. void RTC_ConfigPrescaler(uint32_t value);
  67. void RTC_ConfigAlarm(uint32_t value);
  68. uint32_t RTC_ReadDivider(void);
  69. void RTC_WaitForLastTask(void);
  70. void RTC_WaitForSynchro(void);
  71. /* Interrupts and flags */
  72. void RTC_EnableInterrupt(uint16_t interrupt);
  73. void RTC_DisableInterrupt(uint16_t interrupt);
  74. uint8_t RTC_ReadStatusFlag(RTC_FLAG_T flag);
  75. void RTC_ClearStatusFlag(uint16_t flag);
  76. uint8_t RTC_ReadIntFlag(RTC_INT_T flag);
  77. void RTC_ClearIntFlag(uint16_t flag);
  78. /**@} end of group RTC_Functions */
  79. /**@} end of group RTC_Driver */
  80. /**@} end of group APM32F10x_StdPeriphDriver */
  81. #ifdef __cplusplus
  82. }
  83. #endif
  84. #endif /* __APM32F10X_RTC_H */