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.4 7 * 8 * @date 2022-12-01 9 * 10 * @attention 11 * 12 * Copyright (C) 2020-2022 Geehy Semiconductor 13 * 14 * You may not use this file except in compliance with the 15 * GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE). 16 * 17 * The program is only for reference, which is distributed in the hope 18 * that it will be useful and instructional for customers to develop 19 * their software. Unless required by applicable law or agreed to in 20 * writing, the program is distributed on an "AS IS" BASIS, WITHOUT 21 * ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied. 22 * See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions 23 * and limitations under the License. 24 */ 25 26 #ifndef __APM32F10X_BAKPR_H 27 #define __APM32F10X_BAKPR_H 28 29 /* Includes */ 30 #include "apm32f10x.h" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 /** @addtogroup APM32F10x_StdPeriphDriver 37 @{ 38 */ 39 40 /** @addtogroup BAKPR_Driver BAKPR Driver 41 @{ 42 */ 43 44 /** @defgroup BAKPR_Enumerations Enumerations 45 @{ 46 */ 47 48 /** 49 * @brief BAKPR TAMPER Pin Active Level 50 */ 51 typedef enum 52 { 53 BAKPR_TAMPER_PIN_LEVEL_HIGH, 54 BAKPR_TAMPER_PIN_LEVEL_LOW 55 } BAKPR_TAMPER_PIN_LEVEL_T; 56 57 /** 58 * @brief BAKPR RTC output source 59 */ 60 typedef enum 61 { 62 BAKPR_RTC_OUTPUT_SOURCE_NONE, 63 BAKPR_RTC_OUTPUT_SOURCE_CALIBRATION_CLOCK, 64 BAKPR_RTC_OUTPUT_SOURCE_ALARM, 65 BAKPR_RTC_OUTPUT_SOURCE_SECOND 66 } BAKPR_RTC_OUTPUT_SOURCE_T; 67 68 /** 69 * @brief BAKPR DATA register Addr 70 */ 71 typedef enum 72 { 73 BAKPR_DATA1 = ((uint16_t)0x0004), 74 BAKPR_DATA2 = ((uint16_t)0x0008), 75 BAKPR_DATA3 = ((uint16_t)0x000C), 76 BAKPR_DATA4 = ((uint16_t)0x0010), 77 BAKPR_DATA5 = ((uint16_t)0x0014), 78 BAKPR_DATA6 = ((uint16_t)0x0018), 79 BAKPR_DATA7 = ((uint16_t)0x001C), 80 BAKPR_DATA8 = ((uint16_t)0x0020), 81 BAKPR_DATA9 = ((uint16_t)0x0024), 82 BAKPR_DATA10 = ((uint16_t)0x0028), 83 BAKPR_DATA11 = ((uint16_t)0x0040), 84 BAKPR_DATA12 = ((uint16_t)0x0044), 85 BAKPR_DATA13 = ((uint16_t)0x0048), 86 BAKPR_DATA14 = ((uint16_t)0x004C), 87 BAKPR_DATA15 = ((uint16_t)0x0050), 88 BAKPR_DATA16 = ((uint16_t)0x0054), 89 BAKPR_DATA17 = ((uint16_t)0x0058), 90 BAKPR_DATA18 = ((uint16_t)0x005C), 91 BAKPR_DATA19 = ((uint16_t)0x0060), 92 BAKPR_DATA20 = ((uint16_t)0x0064), 93 BAKPR_DATA21 = ((uint16_t)0x0068), 94 BAKPR_DATA22 = ((uint16_t)0x006C), 95 BAKPR_DATA23 = ((uint16_t)0x0070), 96 BAKPR_DATA24 = ((uint16_t)0x0074), 97 BAKPR_DATA25 = ((uint16_t)0x0078), 98 BAKPR_DATA26 = ((uint16_t)0x007C), 99 BAKPR_DATA27 = ((uint16_t)0x0080), 100 BAKPR_DATA28 = ((uint16_t)0x0084), 101 BAKPR_DATA29 = ((uint16_t)0x0088), 102 BAKPR_DATA30 = ((uint16_t)0x008C), 103 BAKPR_DATA31 = ((uint16_t)0x0090), 104 BAKPR_DATA32 = ((uint16_t)0x0094), 105 BAKPR_DATA33 = ((uint16_t)0x0098), 106 BAKPR_DATA34 = ((uint16_t)0x009C), 107 BAKPR_DATA35 = ((uint16_t)0x00A0), 108 BAKPR_DATA36 = ((uint16_t)0x00A4), 109 BAKPR_DATA37 = ((uint16_t)0x00A8), 110 BAKPR_DATA38 = ((uint16_t)0x00AC), 111 BAKPR_DATA39 = ((uint16_t)0x00B0), 112 BAKPR_DATA40 = ((uint16_t)0x00B4), 113 BAKPR_DATA41 = ((uint16_t)0x00B8), 114 BAKPR_DATA42 = ((uint16_t)0x00BC) 115 } BAKPR_DATA_T; 116 117 /**@} end of group BAKPR_Enumerations*/ 118 119 120 /** @defgroup BAKPR_Functions Functions 121 @{ 122 */ 123 124 /* BAKPR reset and configuration */ 125 void BAKPR_Reset(void); 126 void BAKPR_ConfigTamperPinLevel(BAKPR_TAMPER_PIN_LEVEL_T value); 127 void BAKPR_EnableTamperPin(void); 128 void BAKPR_DisableTamperPin(void); 129 void BAKPR_ConfigRTCOutput(BAKPR_RTC_OUTPUT_SOURCE_T soure); 130 void BAKPR_ConfigRTCCalibrationValue(uint8_t calibrationValue); 131 void BAKPR_ConfigBackupRegister(BAKPR_DATA_T bakrData, uint16_t data); 132 uint16_t BAKPR_ReadBackupRegister(BAKPR_DATA_T bakrData); 133 134 /* Interrupts and flags */ 135 void BAKPR_EnableInterrupt(void); 136 void BAKPR_DisableInterrupt(void); 137 uint8_t BAKPR_ReadStatusFlag(void); 138 void BAKPR_ClearStatusFlag(void); 139 uint8_t BAKPR_ReadIntFlag(void); 140 void BAKPR_ClearIntFlag(void); 141 142 /**@} end of group BAKPR_Functions*/ 143 /**@} end of group BAKPR_Driver */ 144 /**@} end of group APM32F10x_StdPeriphDriver */ 145 146 #ifdef __cplusplus 147 } 148 #endif 149 150 #endif /* __APM32F10X_BAKPR_H */ 151