HAL_bkp.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /**
  2. ******************************************************************************
  3. * @file HAL_bkp.h
  4. * @author AE Team
  5. * @version V1.0.0
  6. * @date 28/7/2017
  7. * @brief This file contains all the functions prototypes for the BKP firmware
  8. * library.
  9. ******************************************************************************
  10. * @copy
  11. *
  12. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  13. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  14. * TIME. AS A RESULT, MindMotion SHALL NOT BE HELD LIABLE FOR ANY
  15. * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  16. * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  17. * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  18. *
  19. * <h2><center>&copy; COPYRIGHT 2017 MindMotion</center></h2>
  20. */
  21. /* Define to prevent recursive inclusion -------------------------------------*/
  22. #ifndef __HAL_BKP_H
  23. #define __HAL_BKP_H
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "HAL_device.h"
  26. /** @addtogroup StdPeriph_Driver
  27. * @{
  28. */
  29. /** @addtogroup BKP
  30. * @{
  31. */
  32. /** @defgroup BKP_Exported_Types
  33. * @{
  34. */
  35. /**
  36. * @}
  37. */
  38. /** @defgroup BKP_Exported_Constants
  39. * @{
  40. */
  41. /** @defgroup Tamper_Pin_active_level
  42. * @{
  43. */
  44. #define BKP_TamperPinLevel_High ((uint16_t)0x0000)
  45. #define BKP_TamperPinLevel_Low ((uint16_t)0x0001)
  46. #define IS_BKP_TAMPER_PIN_LEVEL(LEVEL) (((LEVEL) == BKP_TamperPinLevel_High) || \
  47. ((LEVEL) == BKP_TamperPinLevel_Low))
  48. /**
  49. * @}
  50. */
  51. /** @defgroup RTC_output_source_to_output_on_the_Tamper_pin
  52. * @{
  53. */
  54. #define BKP_RTCOutputSource_None ((uint16_t)0x0000)
  55. #define BKP_RTCOutputSource_CalibClock ((uint16_t)0x0080)
  56. #define BKP_RTCOutputSource_Alarm ((uint16_t)0x0100)
  57. #define BKP_RTCOutputSource_Second ((uint16_t)0x0300)
  58. #define IS_BKP_RTC_OUTPUT_SOURCE(SOURCE) (((SOURCE) == BKP_RTCOutputSource_None) || \
  59. ((SOURCE) == BKP_RTCOutputSource_CalibClock) || \
  60. ((SOURCE) == BKP_RTCOutputSource_Alarm) || \
  61. ((SOURCE) == BKP_RTCOutputSource_Second))
  62. /**
  63. * @}
  64. */
  65. /** @defgroup Data_Backup_Register
  66. * @{
  67. */
  68. #define BKP_DR1 ((uint16_t)0x0004)
  69. #define BKP_DR2 ((uint16_t)0x0008)
  70. #define BKP_DR3 ((uint16_t)0x000C)
  71. #define BKP_DR4 ((uint16_t)0x0010)
  72. #define BKP_DR5 ((uint16_t)0x0014)
  73. #define BKP_DR6 ((uint16_t)0x0018)
  74. #define BKP_DR7 ((uint16_t)0x001C)
  75. #define BKP_DR8 ((uint16_t)0x0020)
  76. #define BKP_DR9 ((uint16_t)0x0024)
  77. #define BKP_DR10 ((uint16_t)0x0028)
  78. #define BKP_DR11 ((uint16_t)0x0040)
  79. #define BKP_DR12 ((uint16_t)0x0044)
  80. #define BKP_DR13 ((uint16_t)0x0048)
  81. #define BKP_DR14 ((uint16_t)0x004C)
  82. #define BKP_DR15 ((uint16_t)0x0050)
  83. #define BKP_DR16 ((uint16_t)0x0054)
  84. #define BKP_DR17 ((uint16_t)0x0058)
  85. #define BKP_DR18 ((uint16_t)0x005C)
  86. #define BKP_DR19 ((uint16_t)0x0060)
  87. #define BKP_DR20 ((uint16_t)0x0064)
  88. #define BKP_DR21 ((uint16_t)0x0068)
  89. #define BKP_DR22 ((uint16_t)0x006C)
  90. #define BKP_DR23 ((uint16_t)0x0070)
  91. #define BKP_DR24 ((uint16_t)0x0074)
  92. #define BKP_DR25 ((uint16_t)0x0078)
  93. #define BKP_DR26 ((uint16_t)0x007C)
  94. #define BKP_DR27 ((uint16_t)0x0080)
  95. #define BKP_DR28 ((uint16_t)0x0084)
  96. #define BKP_DR29 ((uint16_t)0x0088)
  97. #define BKP_DR30 ((uint16_t)0x008C)
  98. #define BKP_DR31 ((uint16_t)0x0090)
  99. #define BKP_DR32 ((uint16_t)0x0094)
  100. #define BKP_DR33 ((uint16_t)0x0098)
  101. #define BKP_DR34 ((uint16_t)0x009C)
  102. #define BKP_DR35 ((uint16_t)0x00A0)
  103. #define BKP_DR36 ((uint16_t)0x00A4)
  104. #define BKP_DR37 ((uint16_t)0x00A8)
  105. #define BKP_DR38 ((uint16_t)0x00AC)
  106. #define BKP_DR39 ((uint16_t)0x00B0)
  107. #define BKP_DR40 ((uint16_t)0x00B4)
  108. #define BKP_DR41 ((uint16_t)0x00B8)
  109. #define BKP_DR42 ((uint16_t)0x00BC)
  110. #define IS_BKP_DR(DR) (((DR) == BKP_DR1) || ((DR) == BKP_DR2) || ((DR) == BKP_DR3) || \
  111. ((DR) == BKP_DR4) || ((DR) == BKP_DR5) || ((DR) == BKP_DR6) || \
  112. ((DR) == BKP_DR7) || ((DR) == BKP_DR8) || ((DR) == BKP_DR9) || \
  113. ((DR) == BKP_DR10) || ((DR) == BKP_DR11) || ((DR) == BKP_DR12) || \
  114. ((DR) == BKP_DR13) || ((DR) == BKP_DR14) || ((DR) == BKP_DR15) || \
  115. ((DR) == BKP_DR16) || ((DR) == BKP_DR17) || ((DR) == BKP_DR18) || \
  116. ((DR) == BKP_DR19) || ((DR) == BKP_DR20) || ((DR) == BKP_DR21) || \
  117. ((DR) == BKP_DR22) || ((DR) == BKP_DR23) || ((DR) == BKP_DR24) || \
  118. ((DR) == BKP_DR25) || ((DR) == BKP_DR26) || ((DR) == BKP_DR27) || \
  119. ((DR) == BKP_DR28) || ((DR) == BKP_DR29) || ((DR) == BKP_DR30) || \
  120. ((DR) == BKP_DR31) || ((DR) == BKP_DR32) || ((DR) == BKP_DR33) || \
  121. ((DR) == BKP_DR34) || ((DR) == BKP_DR35) || ((DR) == BKP_DR36) || \
  122. ((DR) == BKP_DR37) || ((DR) == BKP_DR38) || ((DR) == BKP_DR39) || \
  123. ((DR) == BKP_DR40) || ((DR) == BKP_DR41) || ((DR) == BKP_DR42))
  124. #define IS_BKP_CALIBRATION_VALUE(VALUE) ((VALUE) <= 0x7F)
  125. /**
  126. * @}
  127. */
  128. /**
  129. * @}
  130. */
  131. /** @defgroup BKP_Exported_Macros
  132. * @{
  133. */
  134. /**
  135. * @}
  136. */
  137. /** @defgroup BKP_Exported_Functions
  138. * @{
  139. */
  140. void BKP_DeInit(void);
  141. void BKP_TamperPinLevelConfig(uint16_t BKP_TamperPinLevel);
  142. void BKP_TamperPinCmd(FunctionalState NewState);
  143. void BKP_ITConfig(FunctionalState NewState);
  144. void BKP_RTCOutputConfig(uint16_t BKP_RTCOutputSource);
  145. void BKP_SetRTCCalibrationValue(uint8_t CalibrationValue);
  146. void BKP_WriteBackupRegister(uint16_t BKP_DR, uint16_t Data);
  147. uint16_t BKP_ReadBackupRegister(uint16_t BKP_DR);
  148. FlagStatus BKP_GetFlagStatus(void);
  149. void BKP_ClearFlag(void);
  150. ITStatus BKP_GetITStatus(void);
  151. void BKP_ClearITPendingBit(void);
  152. #endif /* __HAL_BKP_H */
  153. /**
  154. * @}
  155. */
  156. /**
  157. * @}
  158. */
  159. /**
  160. * @}
  161. */
  162. /*-------------------------(C) COPYRIGHT 2017 MindMotion ----------------------*/