apm32f10x_bakpr.h 3.5 KB

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