1 //////////////////////////////////////////////////////////////////////////////// 2 /// @file hal_bkp.h 3 /// @author AE TEAM 4 /// @brief THIS FILE CONTAINS ALL THE FUNCTIONS PROTOTYPES FOR THE BKP 5 /// FIRMWARE LIBRARY. 6 //////////////////////////////////////////////////////////////////////////////// 7 /// @attention 8 /// 9 /// THE EXISTING FIRMWARE IS ONLY FOR REFERENCE, WHICH IS DESIGNED TO PROVIDE 10 /// CUSTOMERS WITH CODING INFORMATION ABOUT THEIR PRODUCTS SO THEY CAN SAVE 11 /// TIME. THEREFORE, MINDMOTION SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT OR 12 /// CONSEQUENTIAL DAMAGES ABOUT ANY CLAIMS ARISING OUT OF THE CONTENT OF SUCH 13 /// HARDWARE AND/OR THE USE OF THE CODING INFORMATION CONTAINED HEREIN IN 14 /// CONNECTION WITH PRODUCTS MADE BY CUSTOMERS. 15 /// 16 /// <H2><CENTER>© COPYRIGHT MINDMOTION </CENTER></H2> 17 //////////////////////////////////////////////////////////////////////////////// 18 19 // Define to prevent recursive inclusion 20 #ifndef __HAL_BKP_H 21 #define __HAL_BKP_H 22 23 // Files includes 24 #include "types.h" 25 #include "reg_bkp.h" 26 27 //////////////////////////////////////////////////////////////////////////////// 28 /// @addtogroup MM32_Hardware_Abstract_Layer 29 /// @{ 30 31 //////////////////////////////////////////////////////////////////////////////// 32 /// @defgroup BKP_HAL 33 /// @brief BKP HAL modules 34 /// @{ 35 36 //////////////////////////////////////////////////////////////////////////////// 37 /// @defgroup BKP_Exported_Types 38 /// @{ 39 //////////////////////////////////////////////////////////////////////////////// 40 /// @brief Data_Backup_Register 41 /// @anchor Data_Backup_Register 42 43 typedef enum { 44 BKP_DR1 = 0x0010, 45 BKP_DR2 = 0x0014, 46 BKP_DR3 = 0x0018, 47 BKP_DR4 = 0x001C, 48 BKP_DR5 = 0x0020, 49 BKP_DR6 = 0x0024, 50 BKP_DR7 = 0x0028, 51 BKP_DR8 = 0x002C, 52 BKP_DR9 = 0x0030, 53 BKP_DR10 = 0x0034, 54 BKP_DR11 = 0x0038, 55 BKP_DR12 = 0x003C, 56 BKP_DR13 = 0x0040, 57 BKP_DR14 = 0x0044, 58 BKP_DR15 = 0x0048, 59 BKP_DR16 = 0x004C, 60 BKP_DR17 = 0x0050, 61 BKP_DR18 = 0x0054, 62 BKP_DR19 = 0x0058, 63 BKP_DR20 = 0x005C 64 } BKPDR_Typedef; 65 66 67 //////////////////////////////////////////////////////////////////////////////// 68 /// @brief Tamper_Pin_active_level 69 /// @anchor Tamper_Pin_active_level 70 typedef enum { 71 BKP_TamperPinLevel_High, ///< Tamper pin active on high level 72 BKP_TamperPinLevel_Low = BKP_CR_TPAL, ///< Tamper pin active on low level 73 } BKPTPAL_Typedef; 74 75 //////////////////////////////////////////////////////////////////////////////// 76 /// @brief RTC_output_source_to_output_on_the_Tamper_pin 77 /// @anchor RTC_output_source_to_output_on_the_Tamper_pin 78 typedef enum { 79 BKP_RTCOutputSource_None = 0x0000, ///< No RTC output on the Tamper pin 80 BKP_RTCOutputSource_CalibClock = 0x0080, ///< Output the RTC clock with frequency divided by 64 on the Tamper pin 81 BKP_RTCOutputSource_Alarm = 0x0100, ///< Output the RTC Alarm pulse signal on the Tamper pin 82 BKP_RTCOutputSource_Second = 0x0300 ///< Output the RTC Second pulse signal on the Tamper pin 83 } BKPRTCOUTPUTSRC_Typedef; 84 85 86 /// @} 87 88 //////////////////////////////////////////////////////////////////////////////// 89 /// @defgroup BKP_Exported_Variables 90 /// @{ 91 #ifdef _HAL_BKP_C_ 92 #define GLOBAL 93 94 #else 95 #define GLOBAL extern 96 #endif 97 98 #undef GLOBAL 99 /// @} 100 101 //////////////////////////////////////////////////////////////////////////////// 102 /// @defgroup BKP_Exported_Functions 103 /// @{ 104 105 void BKP_WriteBackupRegister(BKPDR_Typedef bkp_dr, u16 data); 106 u16 BKP_ReadBackupRegister(BKPDR_Typedef bkp_dr); 107 108 void BKP_DeInit(void); 109 void BKP_ClearFlag(void); 110 void BKP_ClearITPendingBit(void); 111 void BKP_TamperPinLevelConfig(BKPTPAL_Typedef tamper_pin_level); 112 void BKP_TamperPinCmd(FunctionalState state); 113 void BKP_ITConfig(FunctionalState state); 114 void BKP_RTCOutputConfig(BKPRTCOUTPUTSRC_Typedef rtc_output_source); 115 void BKP_SetRTCCalibrationValue(u8 calibration_value); 116 117 ITStatus BKP_GetITStatus(void); 118 FlagStatus BKP_GetFlagStatus(void); 119 void exBKP_Init(void); 120 void exBKP_ImmWrite(BKPDR_Typedef bkp_dr, u16 data); 121 u16 exBKP_ImmRead(BKPDR_Typedef bkp_dr); 122 /// @} 123 124 /// @} 125 126 /// @} 127 128 //////////////////////////////////////////////////////////////////////////////// 129 #endif // __HAL_BKP_H 130 //////////////////////////////////////////////////////////////////////////////// 131