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 /** 29 * @file n32wb452_bkp.h 30 * @author Nations 31 * @version v1.0.0 32 * 33 * @copyright Copyright (c) 2019, Nations Technologies Inc. All rights reserved. 34 */ 35 #ifndef __N32WB452_BKP_H__ 36 #define __N32WB452_BKP_H__ 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 #include "n32wb452.h" 43 44 /** @addtogroup N32WB452_StdPeriph_Driver 45 * @{ 46 */ 47 48 /** @addtogroup BKP 49 * @{ 50 */ 51 52 /** @addtogroup BKP_Exported_Types 53 * @{ 54 */ 55 56 /** 57 * @} 58 */ 59 60 /** @addtogroup BKP_Exported_Constants 61 * @{ 62 */ 63 64 /** @addtogroup Tamper_Pin_active_level 65 * @{ 66 */ 67 68 #define BKP_TP_HIGH ((uint16_t)0x0000) 69 #define BKP_TP_LOW ((uint16_t)0x0001) 70 #define IS_BKP_TP_LEVEL(LEVEL) (((LEVEL) == BKP_TP_HIGH) || ((LEVEL) == BKP_TP_LOW)) 71 /** 72 * @} 73 */ 74 75 76 /** @addtogroup Data_Backup_Register 77 * @{ 78 */ 79 80 #define BKP_DAT1 ((uint16_t)0x0004) 81 #define BKP_DAT2 ((uint16_t)0x0008) 82 #define BKP_DAT3 ((uint16_t)0x000C) 83 #define BKP_DAT4 ((uint16_t)0x0010) 84 #define BKP_DAT5 ((uint16_t)0x0014) 85 #define BKP_DAT6 ((uint16_t)0x0018) 86 #define BKP_DAT7 ((uint16_t)0x001C) 87 #define BKP_DAT8 ((uint16_t)0x0020) 88 #define BKP_DAT9 ((uint16_t)0x0024) 89 #define BKP_DAT10 ((uint16_t)0x0028) 90 #define BKP_DAT11 ((uint16_t)0x0040) 91 #define BKP_DAT12 ((uint16_t)0x0044) 92 #define BKP_DAT13 ((uint16_t)0x0048) 93 #define BKP_DAT14 ((uint16_t)0x004C) 94 #define BKP_DAT15 ((uint16_t)0x0050) 95 #define BKP_DAT16 ((uint16_t)0x0054) 96 #define BKP_DAT17 ((uint16_t)0x0058) 97 #define BKP_DAT18 ((uint16_t)0x005C) 98 #define BKP_DAT19 ((uint16_t)0x0060) 99 #define BKP_DAT20 ((uint16_t)0x0064) 100 #define BKP_DAT21 ((uint16_t)0x0068) 101 #define BKP_DAT22 ((uint16_t)0x006C) 102 #define BKP_DAT23 ((uint16_t)0x0070) 103 #define BKP_DAT24 ((uint16_t)0x0074) 104 #define BKP_DAT25 ((uint16_t)0x0078) 105 #define BKP_DAT26 ((uint16_t)0x007C) 106 #define BKP_DAT27 ((uint16_t)0x0080) 107 #define BKP_DAT28 ((uint16_t)0x0084) 108 #define BKP_DAT29 ((uint16_t)0x0088) 109 #define BKP_DAT30 ((uint16_t)0x008C) 110 #define BKP_DAT31 ((uint16_t)0x0090) 111 #define BKP_DAT32 ((uint16_t)0x0094) 112 #define BKP_DAT33 ((uint16_t)0x0098) 113 #define BKP_DAT34 ((uint16_t)0x009C) 114 #define BKP_DAT35 ((uint16_t)0x00A0) 115 #define BKP_DAT36 ((uint16_t)0x00A4) 116 #define BKP_DAT37 ((uint16_t)0x00A8) 117 #define BKP_DAT38 ((uint16_t)0x00AC) 118 #define BKP_DAT39 ((uint16_t)0x00B0) 119 #define BKP_DAT40 ((uint16_t)0x00B4) 120 #define BKP_DAT41 ((uint16_t)0x00B8) 121 #define BKP_DAT42 ((uint16_t)0x00BC) 122 123 #define IS_BKP_DAT(DAT) \ 124 (((DAT) == BKP_DAT1) || ((DAT) == BKP_DAT2) || ((DAT) == BKP_DAT3) || ((DAT) == BKP_DAT4) || ((DAT) == BKP_DAT5) \ 125 || ((DAT) == BKP_DAT6) || ((DAT) == BKP_DAT7) || ((DAT) == BKP_DAT8) || ((DAT) == BKP_DAT9) \ 126 || ((DAT) == BKP_DAT10) || ((DAT) == BKP_DAT11) || ((DAT) == BKP_DAT12) || ((DAT) == BKP_DAT13) \ 127 || ((DAT) == BKP_DAT14) || ((DAT) == BKP_DAT15) || ((DAT) == BKP_DAT16) || ((DAT) == BKP_DAT17) \ 128 || ((DAT) == BKP_DAT18) || ((DAT) == BKP_DAT19) || ((DAT) == BKP_DAT20) || ((DAT) == BKP_DAT21) \ 129 || ((DAT) == BKP_DAT22) || ((DAT) == BKP_DAT23) || ((DAT) == BKP_DAT24) || ((DAT) == BKP_DAT25) \ 130 || ((DAT) == BKP_DAT26) || ((DAT) == BKP_DAT27) || ((DAT) == BKP_DAT28) || ((DAT) == BKP_DAT29) \ 131 || ((DAT) == BKP_DAT30) || ((DAT) == BKP_DAT31) || ((DAT) == BKP_DAT32) || ((DAT) == BKP_DAT33) \ 132 || ((DAT) == BKP_DAT34) || ((DAT) == BKP_DAT35) || ((DAT) == BKP_DAT36) || ((DAT) == BKP_DAT37) \ 133 || ((DAT) == BKP_DAT38) || ((DAT) == BKP_DAT39) || ((DAT) == BKP_DAT40) || ((DAT) == BKP_DAT41) \ 134 || ((DAT) == BKP_DAT42)) 135 136 /** 137 * @} 138 */ 139 140 /** 141 * @} 142 */ 143 144 /** @addtogroup BKP_Exported_Macros 145 * @{ 146 */ 147 148 /** 149 * @} 150 */ 151 152 /** @addtogroup BKP_Exported_Functions 153 * @{ 154 */ 155 156 void BKP_DeInit(void); 157 void BKP_ConfigTPLevel(uint16_t BKP_TamperPinLevel); 158 void BKP_TPEnable(FunctionalState Cmd); 159 void BKP_TPIntEnable(FunctionalState Cmd); 160 void BKP_WriteBkpData(uint16_t BKP_DAT, uint16_t Data); 161 uint16_t BKP_ReadBkpData(uint16_t BKP_DAT); 162 FlagStatus BKP_GetTEFlag(void); 163 void BKP_ClrTEFlag(void); 164 INTStatus BKP_GetTINTFlag(void); 165 void BKP_ClrTINTFlag(void); 166 167 #ifdef __cplusplus 168 } 169 #endif 170 171 #endif /* __N32WB452_BKP_H__ */ 172 /** 173 * @} 174 */ 175 176 /** 177 * @} 178 */ 179 180 /** 181 * @} 182 */ 183