apm32f10x_bakpr.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*!
  2. * @file apm32f10x_bakr.h
  3. *
  4. * @brief This file contains all the functions prototypes for the BAKPR 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. #ifndef __APM32F10X_BAKPR_H
  26. #define __APM32F10X_BAKPR_H
  27. /* Includes */
  28. #include "apm32f10x.h"
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. /** @addtogroup APM32F10x_StdPeriphDriver
  33. @{
  34. */
  35. /** @addtogroup BAKPR_Driver BAKPR Driver
  36. @{
  37. */
  38. /** @defgroup BAKPR_Enumerations Enumerations
  39. @{
  40. */
  41. /**
  42. * @brief BAKPR TAMPER Pin Active Level
  43. */
  44. typedef enum
  45. {
  46. BAKPR_TAMPER_PIN_LEVEL_HIGH,
  47. BAKPR_TAMPER_PIN_LEVEL_LOW
  48. } BAKPR_TAMPER_PIN_LEVEL_T;
  49. /**
  50. * @brief BAKPR RTC output source
  51. */
  52. typedef enum
  53. {
  54. BAKPR_RTC_OUTPUT_SOURCE_NONE,
  55. BAKPR_RTC_OUTPUT_SOURCE_CALIBRATION_CLOCK,
  56. BAKPR_RTC_OUTPUT_SOURCE_ALARM,
  57. BAKPR_RTC_OUTPUT_SOURCE_SECOND
  58. } BAKPR_RTC_OUTPUT_SOURCE_T;
  59. /**
  60. * @brief BAKPR DATA register Addr
  61. */
  62. typedef enum
  63. {
  64. BAKPR_DATA1 = ((uint16_t)0x0004),
  65. BAKPR_DATA2 = ((uint16_t)0x0008),
  66. BAKPR_DATA3 = ((uint16_t)0x000C),
  67. BAKPR_DATA4 = ((uint16_t)0x0010),
  68. BAKPR_DATA5 = ((uint16_t)0x0014),
  69. BAKPR_DATA6 = ((uint16_t)0x0018),
  70. BAKPR_DATA7 = ((uint16_t)0x001C),
  71. BAKPR_DATA8 = ((uint16_t)0x0020),
  72. BAKPR_DATA9 = ((uint16_t)0x0024),
  73. BAKPR_DATA10 = ((uint16_t)0x0028),
  74. BAKPR_DATA11 = ((uint16_t)0x0040),
  75. BAKPR_DATA12 = ((uint16_t)0x0044),
  76. BAKPR_DATA13 = ((uint16_t)0x0048),
  77. BAKPR_DATA14 = ((uint16_t)0x004C),
  78. BAKPR_DATA15 = ((uint16_t)0x0050),
  79. BAKPR_DATA16 = ((uint16_t)0x0054),
  80. BAKPR_DATA17 = ((uint16_t)0x0058),
  81. BAKPR_DATA18 = ((uint16_t)0x005C),
  82. BAKPR_DATA19 = ((uint16_t)0x0060),
  83. BAKPR_DATA20 = ((uint16_t)0x0064),
  84. BAKPR_DATA21 = ((uint16_t)0x0068),
  85. BAKPR_DATA22 = ((uint16_t)0x006C),
  86. BAKPR_DATA23 = ((uint16_t)0x0070),
  87. BAKPR_DATA24 = ((uint16_t)0x0074),
  88. BAKPR_DATA25 = ((uint16_t)0x0078),
  89. BAKPR_DATA26 = ((uint16_t)0x007C),
  90. BAKPR_DATA27 = ((uint16_t)0x0080),
  91. BAKPR_DATA28 = ((uint16_t)0x0084),
  92. BAKPR_DATA29 = ((uint16_t)0x0088),
  93. BAKPR_DATA30 = ((uint16_t)0x008C),
  94. BAKPR_DATA31 = ((uint16_t)0x0090),
  95. BAKPR_DATA32 = ((uint16_t)0x0094),
  96. BAKPR_DATA33 = ((uint16_t)0x0098),
  97. BAKPR_DATA34 = ((uint16_t)0x009C),
  98. BAKPR_DATA35 = ((uint16_t)0x00A0),
  99. BAKPR_DATA36 = ((uint16_t)0x00A4),
  100. BAKPR_DATA37 = ((uint16_t)0x00A8),
  101. BAKPR_DATA38 = ((uint16_t)0x00AC),
  102. BAKPR_DATA39 = ((uint16_t)0x00B0),
  103. BAKPR_DATA40 = ((uint16_t)0x00B4),
  104. BAKPR_DATA41 = ((uint16_t)0x00B8),
  105. BAKPR_DATA42 = ((uint16_t)0x00BC)
  106. } BAKPR_DATA_T;
  107. /**@} end of group BAKPR_Enumerations*/
  108. /** @defgroup BAKPR_Functions Functions
  109. @{
  110. */
  111. /* BAKPR reset and configuration */
  112. void BAKPR_Reset(void);
  113. void BAKPR_ConfigTamperPinLevel(BAKPR_TAMPER_PIN_LEVEL_T value);
  114. void BAKPR_EnableTamperPin(void);
  115. void BAKPR_DisableTamperPin(void);
  116. void BAKPR_ConfigRTCOutput(BAKPR_RTC_OUTPUT_SOURCE_T soure);
  117. void BAKPR_ConfigRTCCalibrationValue(uint8_t calibrationValue);
  118. void BAKPR_ConfigBackupRegister(BAKPR_DATA_T bakrData, uint16_t data);
  119. uint16_t BAKPR_ReadBackupRegister(BAKPR_DATA_T bakrData);
  120. /* Interrupts and flags */
  121. void BAKPR_EnableInterrupt(void);
  122. void BAKPR_DisableInterrupt(void);
  123. uint8_t BAKPR_ReadStatusFlag(void);
  124. void BAKPR_ClearStatusFlag(void);
  125. uint8_t BAKPR_ReadIntFlag(void);
  126. void BAKPR_ClearIntFlag(void);
  127. /**@} end of group BAKPR_Functions*/
  128. /**@} end of group BAKPR_Driver */
  129. /**@} end of group APM32F10x_StdPeriphDriver */
  130. #ifdef __cplusplus
  131. }
  132. #endif
  133. #endif /* __APM32F10X_BAKPR_H */