n32g45x_bkp.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /*****************************************************************************
  2. * Copyright (c) 2019, Nations Technologies Inc.
  3. *
  4. * All rights reserved.
  5. * ****************************************************************************
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions are met:
  9. *
  10. * - Redistributions of source code must retain the above copyright notice,
  11. * this list of conditions and the disclaimer below.
  12. *
  13. * Nations' name may not be used to endorse or promote products derived from
  14. * this software without specific prior written permission.
  15. *
  16. * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY NATIONS "AS IS" AND ANY EXPRESS OR
  17. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  18. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
  19. * DISCLAIMED. IN NO EVENT SHALL NATIONS BE LIABLE FOR ANY DIRECT, INDIRECT,
  20. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  21. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  22. * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  23. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  24. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  25. * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. * ****************************************************************************/
  27. /**
  28. * @file n32g45x_bkp.h
  29. * @author Nations
  30. * @version v1.0.0
  31. *
  32. * @copyright Copyright (c) 2019, Nations Technologies Inc. All rights reserved.
  33. */
  34. #ifndef __N32G45X_BKP_H__
  35. #define __N32G45X_BKP_H__
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39. #include "n32g45x.h"
  40. /** @addtogroup N32G45X_StdPeriph_Driver
  41. * @{
  42. */
  43. /** @addtogroup BKP
  44. * @{
  45. */
  46. /** @addtogroup BKP_Exported_Types
  47. * @{
  48. */
  49. /**
  50. * @}
  51. */
  52. /** @addtogroup BKP_Exported_Constants
  53. * @{
  54. */
  55. /** @addtogroup Tamper_Pin_active_level
  56. * @{
  57. */
  58. #define BKP_TP_HIGH ((uint16_t)0x0000)
  59. #define BKP_TP_LOW ((uint16_t)0x0001)
  60. #define IS_BKP_TP_LEVEL(LEVEL) (((LEVEL) == BKP_TP_HIGH) || ((LEVEL) == BKP_TP_LOW))
  61. /**
  62. * @}
  63. */
  64. /** @addtogroup Data_Backup_Register
  65. * @{
  66. */
  67. #define BKP_DAT1 ((uint16_t)0x0004)
  68. #define BKP_DAT2 ((uint16_t)0x0008)
  69. #define BKP_DAT3 ((uint16_t)0x000C)
  70. #define BKP_DAT4 ((uint16_t)0x0010)
  71. #define BKP_DAT5 ((uint16_t)0x0014)
  72. #define BKP_DAT6 ((uint16_t)0x0018)
  73. #define BKP_DAT7 ((uint16_t)0x001C)
  74. #define BKP_DAT8 ((uint16_t)0x0020)
  75. #define BKP_DAT9 ((uint16_t)0x0024)
  76. #define BKP_DAT10 ((uint16_t)0x0028)
  77. #define BKP_DAT11 ((uint16_t)0x0040)
  78. #define BKP_DAT12 ((uint16_t)0x0044)
  79. #define BKP_DAT13 ((uint16_t)0x0048)
  80. #define BKP_DAT14 ((uint16_t)0x004C)
  81. #define BKP_DAT15 ((uint16_t)0x0050)
  82. #define BKP_DAT16 ((uint16_t)0x0054)
  83. #define BKP_DAT17 ((uint16_t)0x0058)
  84. #define BKP_DAT18 ((uint16_t)0x005C)
  85. #define BKP_DAT19 ((uint16_t)0x0060)
  86. #define BKP_DAT20 ((uint16_t)0x0064)
  87. #define BKP_DAT21 ((uint16_t)0x0068)
  88. #define BKP_DAT22 ((uint16_t)0x006C)
  89. #define BKP_DAT23 ((uint16_t)0x0070)
  90. #define BKP_DAT24 ((uint16_t)0x0074)
  91. #define BKP_DAT25 ((uint16_t)0x0078)
  92. #define BKP_DAT26 ((uint16_t)0x007C)
  93. #define BKP_DAT27 ((uint16_t)0x0080)
  94. #define BKP_DAT28 ((uint16_t)0x0084)
  95. #define BKP_DAT29 ((uint16_t)0x0088)
  96. #define BKP_DAT30 ((uint16_t)0x008C)
  97. #define BKP_DAT31 ((uint16_t)0x0090)
  98. #define BKP_DAT32 ((uint16_t)0x0094)
  99. #define BKP_DAT33 ((uint16_t)0x0098)
  100. #define BKP_DAT34 ((uint16_t)0x009C)
  101. #define BKP_DAT35 ((uint16_t)0x00A0)
  102. #define BKP_DAT36 ((uint16_t)0x00A4)
  103. #define BKP_DAT37 ((uint16_t)0x00A8)
  104. #define BKP_DAT38 ((uint16_t)0x00AC)
  105. #define BKP_DAT39 ((uint16_t)0x00B0)
  106. #define BKP_DAT40 ((uint16_t)0x00B4)
  107. #define BKP_DAT41 ((uint16_t)0x00B8)
  108. #define BKP_DAT42 ((uint16_t)0x00BC)
  109. #define IS_BKP_DAT(DAT) \
  110. (((DAT) == BKP_DAT1) || ((DAT) == BKP_DAT2) || ((DAT) == BKP_DAT3) || ((DAT) == BKP_DAT4) || ((DAT) == BKP_DAT5) \
  111. || ((DAT) == BKP_DAT6) || ((DAT) == BKP_DAT7) || ((DAT) == BKP_DAT8) || ((DAT) == BKP_DAT9) \
  112. || ((DAT) == BKP_DAT10) || ((DAT) == BKP_DAT11) || ((DAT) == BKP_DAT12) || ((DAT) == BKP_DAT13) \
  113. || ((DAT) == BKP_DAT14) || ((DAT) == BKP_DAT15) || ((DAT) == BKP_DAT16) || ((DAT) == BKP_DAT17) \
  114. || ((DAT) == BKP_DAT18) || ((DAT) == BKP_DAT19) || ((DAT) == BKP_DAT20) || ((DAT) == BKP_DAT21) \
  115. || ((DAT) == BKP_DAT22) || ((DAT) == BKP_DAT23) || ((DAT) == BKP_DAT24) || ((DAT) == BKP_DAT25) \
  116. || ((DAT) == BKP_DAT26) || ((DAT) == BKP_DAT27) || ((DAT) == BKP_DAT28) || ((DAT) == BKP_DAT29) \
  117. || ((DAT) == BKP_DAT30) || ((DAT) == BKP_DAT31) || ((DAT) == BKP_DAT32) || ((DAT) == BKP_DAT33) \
  118. || ((DAT) == BKP_DAT34) || ((DAT) == BKP_DAT35) || ((DAT) == BKP_DAT36) || ((DAT) == BKP_DAT37) \
  119. || ((DAT) == BKP_DAT38) || ((DAT) == BKP_DAT39) || ((DAT) == BKP_DAT40) || ((DAT) == BKP_DAT41) \
  120. || ((DAT) == BKP_DAT42))
  121. /**
  122. * @}
  123. */
  124. /**
  125. * @}
  126. */
  127. /** @addtogroup BKP_Exported_Macros
  128. * @{
  129. */
  130. /**
  131. * @}
  132. */
  133. /** @addtogroup BKP_Exported_Functions
  134. * @{
  135. */
  136. void BKP_DeInit(void);
  137. void BKP_ConfigTPLevel(uint16_t BKP_TamperPinLevel);
  138. void BKP_TPEnable(FunctionalState Cmd);
  139. void BKP_TPIntEnable(FunctionalState Cmd);
  140. void BKP_WriteBkpData(uint16_t BKP_DAT, uint16_t Data);
  141. uint16_t BKP_ReadBkpData(uint16_t BKP_DAT);
  142. FlagStatus BKP_GetTEFlag(void);
  143. void BKP_ClrTEFlag(void);
  144. INTStatus BKP_GetTINTFlag(void);
  145. void BKP_ClrTINTFlag(void);
  146. #ifdef __cplusplus
  147. }
  148. #endif
  149. #endif /* __N32G45X_BKP_H__ */
  150. /**
  151. * @}
  152. */
  153. /**
  154. * @}
  155. */
  156. /**
  157. * @}
  158. */