MG32F10x Standard Peripherals Firmware Library

mg32f10x_bkp.h
浏览该文件的文档.
1
10 /* Define to prevent recursive inclusion -------------------------------------*/
11 #ifndef __MG32F10x_BKP_H
12 #define __MG32F10x_BKP_H
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 /* Includes ------------------------------------------------------------------*/
19 #include "mg32f10x.h"
20
29 /* Exported types ------------------------------------------------------------*/
30 /* Exported constants --------------------------------------------------------*/
31
39 #define BKP_TamperPinLevel_High ((uint16_t)0x0000)
40 #define BKP_TamperPinLevel_Low ((uint16_t)0x0001)
41 #define IS_BKP_TAMPER_PIN_LEVEL(LEVEL) (((LEVEL) == BKP_TamperPinLevel_High) || \
42 ((LEVEL) == BKP_TamperPinLevel_Low))
43
50 #define BKP_RTCOutputSource_None ((uint16_t)0x0000)
51 #define BKP_RTCOutputSource_CalibClock ((uint16_t)0x0080)
52 #define BKP_RTCOutputSource_Alarm ((uint16_t)0x0100)
53 #define BKP_RTCOutputSource_Second ((uint16_t)0x0300)
54 #define IS_BKP_RTC_OUTPUT_SOURCE(SOURCE) (((SOURCE) == BKP_RTCOutputSource_None) || \
55 ((SOURCE) == BKP_RTCOutputSource_CalibClock) || \
56 ((SOURCE) == BKP_RTCOutputSource_Alarm) || \
57 ((SOURCE) == BKP_RTCOutputSource_Second))
58
65 #define BKP_DR1 ((uint32_t)0x00000010)
66 #define BKP_DR2 ((uint32_t)0x00000014)
67 #define BKP_DR3 ((uint32_t)0x00000018)
68 #define BKP_DR4 ((uint32_t)0x0000001C)
69 #define BKP_DR5 ((uint32_t)0x00000020)
70 #define BKP_DR6 ((uint32_t)0x00000024)
71 #define BKP_DR7 ((uint32_t)0x00000028)
72 #define BKP_DR8 ((uint32_t)0x0000002C)
73 #define BKP_DR9 ((uint32_t)0x00000030)
74 #define BKP_DR10 ((uint32_t)0x00000034)
75 #define BKP_DR11 ((uint32_t)0x00000038)
76 #define BKP_DR12 ((uint32_t)0x0000003C)
77 #define BKP_DR13 ((uint32_t)0x00000040)
78 #define BKP_DR14 ((uint32_t)0x00000044)
79 #define BKP_DR15 ((uint32_t)0x00000048)
80 #define BKP_DR16 ((uint32_t)0x0000004C)
81 #define BKP_DR17 ((uint32_t)0x00000050)
82 #define BKP_DR18 ((uint32_t)0x00000054)
83 #define BKP_DR19 ((uint32_t)0x00000058)
84 #define BKP_DR20 ((uint32_t)0x0000005C)
85 #define BKP_DR21 ((uint32_t)0x00000060)
86
87 #define IS_BKP_DR(DR) (((DR) == BKP_DR1) || ((DR) == BKP_DR2) || ((DR) == BKP_DR3) || \
88 ((DR) == BKP_DR4) || ((DR) == BKP_DR5) || ((DR) == BKP_DR6) || \
89 ((DR) == BKP_DR7) || ((DR) == BKP_DR8) || ((DR) == BKP_DR9) || \
90 ((DR) == BKP_DR10) || ((DR) == BKP_DR11) || ((DR) == BKP_DR12) || \
91 ((DR) == BKP_DR13) || ((DR) == BKP_DR14) || ((DR) == BKP_DR15) || \
92 ((DR) == BKP_DR16) || ((DR) == BKP_DR17) || ((DR) == BKP_DR18) || \
93 ((DR) == BKP_DR19) || ((DR) == BKP_DR20) || ((DR) == BKP_DR21))
94
95 #define IS_BKP_CALIBRATION_VALUE(VALUE) ((VALUE) <= 0x7F)
96
103 #define BKP_RTCCLKSource_LSE ((uint32_t)0x00000100)
104 #define BKP_RTCCLKSource_LSI ((uint32_t)0x00000200)
105 #define BKP_RTCCLKSource_HSE_Div128 ((uint32_t)0x00000300)
106
113 #define BKP_LSE_OFF ((uint32_t)0x00000000)
114 #define BKP_LSE_ON ((uint32_t)0x00000001)
115 #define BKP_LSE_Bypass ((uint32_t)0x00000004)
116
124 /* Exported macro ------------------------------------------------------------*/
125 /* Exported functions --------------------------------------------------------*/
126
127 void BKP_DeInit(void);
128 void BKP_TamperPinLevelConfig(uint16_t BKP_TamperPinLevel);
129 void BKP_TamperPinCmd(FunctionalState NewState);
130 void BKP_ITConfig(FunctionalState NewState);
131 void BKP_RTCOutputConfig(uint16_t BKP_RTCOutputSource);
132 void BKP_SetRTCCalibrationValue(uint8_t CalibrationValue);
133 void BKP_WriteBackupRegister(uint32_t BKP_DR, uint32_t Data);
134 uint32_t BKP_ReadBackupRegister(uint32_t BKP_DR);
135 FlagStatus BKP_GetFlagStatus(void);
136 void BKP_ClearFlag(void);
137 ITStatus BKP_GetITStatus(void);
138 void BKP_ClearITPendingBit(void);
139
140 void BKP_RTCCLKConfig(uint32_t BKP_RTCCLKSource);
141 void BKP_RTCCLKCmd(FunctionalState NewState);
142 void BKP_LSEConfig(uint32_t BKP_LSE);
143 FlagStatus BKP_GetLSEReadyFlagStatus(void);
144
153 #ifdef __cplusplus
154 }
155 #endif
156
157 #endif /* __MG32F10x_BKP_H */
BKP_ReadBackupRegister
uint32_t BKP_ReadBackupRegister(uint32_t BKP_DR)
Reads data from the specified Data Backup Register.
Definition: mg32f10x_bkp.c:198
BKP_ClearFlag
void BKP_ClearFlag(void)
Clears Tamper Pin Event pending flag.
Definition: mg32f10x_bkp.c:221
BKP_GetLSEReadyFlagStatus
FlagStatus BKP_GetLSEReadyFlagStatus(void)
Checks whether the LSE Ready flag is set or not.
Definition: mg32f10x_bkp.c:322
BKP_RTCCLKConfig
void BKP_RTCCLKConfig(uint32_t BKP_RTCCLKSource)
Configures the RTC clock (RTCCLK).
Definition: mg32f10x_bkp.c:259
BKP_RTCOutputConfig
void BKP_RTCOutputConfig(uint16_t BKP_RTCOutputSource)
Select the RTC output source to output on the Tamper pin.
Definition: mg32f10x_bkp.c:142
BKP_RTCCLKCmd
void BKP_RTCCLKCmd(FunctionalState NewState)
Enables or disables the RTC clock.
Definition: mg32f10x_bkp.c:278
BKP_GetFlagStatus
FlagStatus BKP_GetFlagStatus(void)
Checks whether the Tamper Pin Event flag is set or not.
Definition: mg32f10x_bkp.c:211
BKP_GetITStatus
ITStatus BKP_GetITStatus(void)
Checks whether the Tamper Pin Interrupt has occurred or not.
Definition: mg32f10x_bkp.c:232
BKP_ITConfig
void BKP_ITConfig(FunctionalState NewState)
Enables or disables the Tamper Pin Interrupt.
Definition: mg32f10x_bkp.c:122
BKP_TamperPinLevelConfig
void BKP_TamperPinLevelConfig(uint16_t BKP_TamperPinLevel)
Configures the Tamper Pin active level.
Definition: mg32f10x_bkp.c:96
BKP_ClearITPendingBit
void BKP_ClearITPendingBit(void)
Clears Tamper Pin Interrupt pending bit.
Definition: mg32f10x_bkp.c:242
BKP_LSEConfig
void BKP_LSEConfig(uint32_t BKP_LSE)
Configures the External Low Speed oscillator (LSE).
Definition: mg32f10x_bkp.c:292
BKP_SetRTCCalibrationValue
void BKP_SetRTCCalibrationValue(uint8_t CalibrationValue)
Sets RTC Clock Calibration value.
Definition: mg32f10x_bkp.c:163
BKP_WriteBackupRegister
void BKP_WriteBackupRegister(uint32_t BKP_DR, uint32_t Data)
Writes user data to the specified Data Backup Register.
Definition: mg32f10x_bkp.c:184
BKP_DeInit
void BKP_DeInit(void)
Deinitializes the BKP peripheral registers to their default reset values.
Definition: mg32f10x_bkp.c:82
BKP_TamperPinCmd
void BKP_TamperPinCmd(FunctionalState NewState)
Enables or disables the Tamper Pin activation.
Definition: mg32f10x_bkp.c:109