apm32f10x_bakpr.h 4.1 KB

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