stm32f10x_bkp.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
  2. * File Name : stm32f10x_bkp.h
  3. * Author : MCD Application Team
  4. * Version : V2.0.3
  5. * Date : 09/22/2008
  6. * Description : This file contains all the functions prototypes for the
  7. * BKP firmware library.
  8. ********************************************************************************
  9. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  10. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
  11. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
  12. * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
  13. * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
  14. * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  15. *******************************************************************************/
  16. /* Define to prevent recursive inclusion -------------------------------------*/
  17. #ifndef __STM32F10x_BKP_H
  18. #define __STM32F10x_BKP_H
  19. /* Includes ------------------------------------------------------------------*/
  20. #include "stm32f10x_map.h"
  21. /* Exported types ------------------------------------------------------------*/
  22. /* Exported constants --------------------------------------------------------*/
  23. /* Tamper Pin active level */
  24. #define BKP_TamperPinLevel_High ((u16)0x0000)
  25. #define BKP_TamperPinLevel_Low ((u16)0x0001)
  26. #define IS_BKP_TAMPER_PIN_LEVEL(LEVEL) (((LEVEL) == BKP_TamperPinLevel_High) || \
  27. ((LEVEL) == BKP_TamperPinLevel_Low))
  28. /* RTC output source to output on the Tamper pin */
  29. #define BKP_RTCOutputSource_None ((u16)0x0000)
  30. #define BKP_RTCOutputSource_CalibClock ((u16)0x0080)
  31. #define BKP_RTCOutputSource_Alarm ((u16)0x0100)
  32. #define BKP_RTCOutputSource_Second ((u16)0x0300)
  33. #define IS_BKP_RTC_OUTPUT_SOURCE(SOURCE) (((SOURCE) == BKP_RTCOutputSource_None) || \
  34. ((SOURCE) == BKP_RTCOutputSource_CalibClock) || \
  35. ((SOURCE) == BKP_RTCOutputSource_Alarm) || \
  36. ((SOURCE) == BKP_RTCOutputSource_Second))
  37. /* Data Backup Register */
  38. #define BKP_DR1 ((u16)0x0004)
  39. #define BKP_DR2 ((u16)0x0008)
  40. #define BKP_DR3 ((u16)0x000C)
  41. #define BKP_DR4 ((u16)0x0010)
  42. #define BKP_DR5 ((u16)0x0014)
  43. #define BKP_DR6 ((u16)0x0018)
  44. #define BKP_DR7 ((u16)0x001C)
  45. #define BKP_DR8 ((u16)0x0020)
  46. #define BKP_DR9 ((u16)0x0024)
  47. #define BKP_DR10 ((u16)0x0028)
  48. #define BKP_DR11 ((u16)0x0040)
  49. #define BKP_DR12 ((u16)0x0044)
  50. #define BKP_DR13 ((u16)0x0048)
  51. #define BKP_DR14 ((u16)0x004C)
  52. #define BKP_DR15 ((u16)0x0050)
  53. #define BKP_DR16 ((u16)0x0054)
  54. #define BKP_DR17 ((u16)0x0058)
  55. #define BKP_DR18 ((u16)0x005C)
  56. #define BKP_DR19 ((u16)0x0060)
  57. #define BKP_DR20 ((u16)0x0064)
  58. #define BKP_DR21 ((u16)0x0068)
  59. #define BKP_DR22 ((u16)0x006C)
  60. #define BKP_DR23 ((u16)0x0070)
  61. #define BKP_DR24 ((u16)0x0074)
  62. #define BKP_DR25 ((u16)0x0078)
  63. #define BKP_DR26 ((u16)0x007C)
  64. #define BKP_DR27 ((u16)0x0080)
  65. #define BKP_DR28 ((u16)0x0084)
  66. #define BKP_DR29 ((u16)0x0088)
  67. #define BKP_DR30 ((u16)0x008C)
  68. #define BKP_DR31 ((u16)0x0090)
  69. #define BKP_DR32 ((u16)0x0094)
  70. #define BKP_DR33 ((u16)0x0098)
  71. #define BKP_DR34 ((u16)0x009C)
  72. #define BKP_DR35 ((u16)0x00A0)
  73. #define BKP_DR36 ((u16)0x00A4)
  74. #define BKP_DR37 ((u16)0x00A8)
  75. #define BKP_DR38 ((u16)0x00AC)
  76. #define BKP_DR39 ((u16)0x00B0)
  77. #define BKP_DR40 ((u16)0x00B4)
  78. #define BKP_DR41 ((u16)0x00B8)
  79. #define BKP_DR42 ((u16)0x00BC)
  80. #define IS_BKP_DR(DR) (((DR) == BKP_DR1) || ((DR) == BKP_DR2) || ((DR) == BKP_DR3) || \
  81. ((DR) == BKP_DR4) || ((DR) == BKP_DR5) || ((DR) == BKP_DR6) || \
  82. ((DR) == BKP_DR7) || ((DR) == BKP_DR8) || ((DR) == BKP_DR9) || \
  83. ((DR) == BKP_DR10) || ((DR) == BKP_DR11) || ((DR) == BKP_DR12) || \
  84. ((DR) == BKP_DR13) || ((DR) == BKP_DR14) || ((DR) == BKP_DR15) || \
  85. ((DR) == BKP_DR16) || ((DR) == BKP_DR17) || ((DR) == BKP_DR18) || \
  86. ((DR) == BKP_DR19) || ((DR) == BKP_DR20) || ((DR) == BKP_DR21) || \
  87. ((DR) == BKP_DR22) || ((DR) == BKP_DR23) || ((DR) == BKP_DR24) || \
  88. ((DR) == BKP_DR25) || ((DR) == BKP_DR26) || ((DR) == BKP_DR27) || \
  89. ((DR) == BKP_DR28) || ((DR) == BKP_DR29) || ((DR) == BKP_DR30) || \
  90. ((DR) == BKP_DR31) || ((DR) == BKP_DR32) || ((DR) == BKP_DR33) || \
  91. ((DR) == BKP_DR34) || ((DR) == BKP_DR35) || ((DR) == BKP_DR36) || \
  92. ((DR) == BKP_DR37) || ((DR) == BKP_DR38) || ((DR) == BKP_DR39) || \
  93. ((DR) == BKP_DR40) || ((DR) == BKP_DR41) || ((DR) == BKP_DR42))
  94. #define IS_BKP_CALIBRATION_VALUE(VALUE) ((VALUE) <= 0x7F)
  95. /* Exported macro ------------------------------------------------------------*/
  96. /* Exported functions ------------------------------------------------------- */
  97. void BKP_DeInit(void);
  98. void BKP_TamperPinLevelConfig(u16 BKP_TamperPinLevel);
  99. void BKP_TamperPinCmd(FunctionalState NewState);
  100. void BKP_ITConfig(FunctionalState NewState);
  101. void BKP_RTCOutputConfig(u16 BKP_RTCOutputSource);
  102. void BKP_SetRTCCalibrationValue(u8 CalibrationValue);
  103. void BKP_WriteBackupRegister(u16 BKP_DR, u16 Data);
  104. u16 BKP_ReadBackupRegister(u16 BKP_DR);
  105. FlagStatus BKP_GetFlagStatus(void);
  106. void BKP_ClearFlag(void);
  107. ITStatus BKP_GetITStatus(void);
  108. void BKP_ClearITPendingBit(void);
  109. #endif /* __STM32F10x_BKP_H */
  110. /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/