1 /*! 2 * @file apm32s10x_bakr.h 3 * 4 * @brief This file contains all the functions prototypes for the BAKPR firmware library. 5 * 6 * @version V1.0.1 7 * 8 * @date 2022-12-31 9 * 10 * @attention 11 * 12 * Copyright (C) 2022-2023 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 usefull 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 /* Define to prevent recursive inclusion */ 27 #ifndef __APM32S10X_BAKPR_H 28 #define __APM32S10X_BAKPR_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 /* Includes */ 35 #include "apm32s10x.h" 36 37 /** @addtogroup APM32S10x_StdPeriphDriver 38 @{ 39 */ 40 41 /** @addtogroup BAKPR_Driver BAKPR Driver 42 @{ 43 */ 44 45 /** @defgroup BAKPR_Enumerations Enumerations 46 @{ 47 */ 48 49 /** 50 * @brief BAKPR TAMPER Pin Active Level 51 */ 52 typedef enum 53 { 54 BAKPR_TAMPER_PIN_LEVEL_HIGH, 55 BAKPR_TAMPER_PIN_LEVEL_LOW 56 } BAKPR_TAMPER_PIN_LEVEL_T; 57 58 /** 59 * @brief BAKPR RTC output source 60 */ 61 typedef enum 62 { 63 BAKPR_RTC_OUTPUT_SOURCE_NONE, 64 BAKPR_RTC_OUTPUT_SOURCE_CALIBRATION_CLOCK, 65 BAKPR_RTC_OUTPUT_SOURCE_ALARM, 66 BAKPR_RTC_OUTPUT_SOURCE_SECOND 67 } BAKPR_RTC_OUTPUT_SOURCE_T; 68 69 /** 70 * @brief BAKPR DATA register Addr 71 */ 72 typedef enum 73 { 74 BAKPR_DATA1 = ((uint16_t)0x0004), 75 BAKPR_DATA2 = ((uint16_t)0x0008), 76 BAKPR_DATA3 = ((uint16_t)0x000C), 77 BAKPR_DATA4 = ((uint16_t)0x0010), 78 BAKPR_DATA5 = ((uint16_t)0x0014), 79 BAKPR_DATA6 = ((uint16_t)0x0018), 80 BAKPR_DATA7 = ((uint16_t)0x001C), 81 BAKPR_DATA8 = ((uint16_t)0x0020), 82 BAKPR_DATA9 = ((uint16_t)0x0024), 83 BAKPR_DATA10 = ((uint16_t)0x0028) 84 } BAKPR_DATA_T; 85 86 /**@} end of group BAKPR_Enumerations */ 87 88 /** @defgroup BAKPR_Functions Functions 89 @{ 90 */ 91 92 /* BAKPR reset and configuration */ 93 void BAKPR_Reset(void); 94 void BAKPR_ConfigTamperPinLevel(BAKPR_TAMPER_PIN_LEVEL_T value); 95 void BAKPR_EnableTamperPin(void); 96 void BAKPR_DisableTamperPin(void); 97 void BAKPR_ConfigRTCOutput(BAKPR_RTC_OUTPUT_SOURCE_T soure); 98 void BAKPR_ConfigRTCCalibrationValue(uint8_t calibrationValue); 99 void BAKPR_ConfigBackupRegister(BAKPR_DATA_T bakrData, uint16_t data); 100 uint16_t BAKPR_ReadBackupRegister(BAKPR_DATA_T bakrData); 101 102 /* Interrupts and flags */ 103 void BAKPR_EnableInterrupt(void); 104 void BAKPR_DisableInterrupt(void); 105 uint8_t BAKPR_ReadStatusFlag(void); 106 void BAKPR_ClearStatusFlag(void); 107 uint8_t BAKPR_ReadIntFlag(void); 108 void BAKPR_ClearIntFlag(void); 109 110 /**@} end of group BAKPR_Functions */ 111 /**@} end of group BAKPR_Driver */ 112 /**@} end of group APM32S10x_StdPeriphDriver */ 113 114 #ifdef __cplusplus 115 } 116 #endif 117 118 #endif /* __APM32S10X_BAKPR_H */ 119