📄 stm32f10x_bkp.lst
字号:
128 /*******************************************************************************
129 * Function Name : BKP_RTCOutputConfig
130 * Description : Select the RTC output source to output on the Tamper pin.
131 * Input : - BKP_RTCOutputSource: specifies the RTC output source.
132 * This parameter can be one of the following values:
133 * - BKP_RTCOutputSource_None: no RTC output on the Tamper pin.
134 * - BKP_RTCOutputSource_CalibClock: output the RTC clock
135 * with frequency divided by 64 on the Tamper pin.
136 * - BKP_RTCOutputSource_Alarm: output the RTC Alarm pulse
137 * signal on the Tamper pin.
138 * - BKP_RTCOutputSource_Second: output the RTC Second pulse
139 * signal on the Tamper pin.
140 * Output : None
141 * Return : None
142 *******************************************************************************/
143 void BKP_RTCOutputConfig(u16 BKP_RTCOutputSource)
144 {
145 u16 tmpreg = 0;
146
147 /* Check the parameters */
148 assert_param(IS_BKP_RTC_OUTPUT_SOURCE(BKP_RTCOutputSource));
149
150 tmpreg = BKP->RTCCR;
151
152 /* Clear CCO, ASOE and ASOS bits */
153 tmpreg &= RTCCR_Mask;
154
155 /* Set CCO, ASOE and ASOS bits according to BKP_RTCOutputSource value */
156 tmpreg |= BKP_RTCOutputSource;
157
158 /* Store the new value */
159 BKP->RTCCR = tmpreg;
160 }
161
162 /*******************************************************************************
163 * Function Name : BKP_SetRTCCalibrationValue
164 * Description : Sets RTC Clock Calibration value.
165 * Input : - CalibrationValue: specifies the RTC Clock Calibration value.
166 * This parameter must be a number between 0 and 0x7F.
167 * Output : None
168 * Return : None
169 *******************************************************************************/
170 void BKP_SetRTCCalibrationValue(u8 CalibrationValue)
171 {
172 u16 tmpreg = 0;
173
174 /* Check the parameters */
175 assert_param(IS_BKP_CALIBRATION_VALUE(CalibrationValue));
176
177 tmpreg = BKP->RTCCR;
178
179 /* Clear CAL[6:0] bits */
180 tmpreg &= RTCCR_CAL_Mask;
181
182 /* Set CAL[6:0] bits according to CalibrationValue value */
183 tmpreg |= CalibrationValue;
184
185 /* Store the new value */
186 BKP->RTCCR = tmpreg;
187 }
188
189 /*******************************************************************************
190 * Function Name : BKP_WriteBackupRegister
191 * Description : Writes user data to the specified Data Backup Register.
192 * Input : - BKP_DR: specifies the Data Backup Register.
193 * This parameter can be BKP_DRx where x:[1, 10]
194 * - Data: data to write
195 * Output : None
196 * Return : None
197 *******************************************************************************/
198 void BKP_WriteBackupRegister(u16 BKP_DR, u16 Data)
199 {
200 /* Check the parameters */
201 assert_param(IS_BKP_DR(BKP_DR));
202
203 *(vu16 *) (BKP_BASE + BKP_DR) = Data;
204 }
205
206 /*******************************************************************************
207 * Function Name : BKP_ReadBackupRegister
208 * Description : Reads data from the specified Data Backup Register.
209 * Input : - BKP_DR: specifies the Data Backup Register.
210 * This parameter can be BKP_DRx where x:[1, 10]
211 * Output : None
212 * Return : The content of the specified Data Backup Register
213 *******************************************************************************/
214 u16 BKP_ReadBackupRegister(u16 BKP_DR)
215 {
216 /* Check the parameters */
217 assert_param(IS_BKP_DR(BKP_DR));
218
219 return (*(vu16 *) (BKP_BASE + BKP_DR));
220 }
221
222 /*******************************************************************************
223 * Function Name : BKP_GetFlagStatus
224 * Description : Checks whether the Tamper Pin Event flag is set or not.
225 * Input : None
226 * Output : None
227 * Return : The new state of the Tamper Pin Event flag (SET or RESET).
228 *******************************************************************************/
229 FlagStatus BKP_GetFlagStatus(void)
230 {
231 return (FlagStatus)(*(vu32 *) CSR_TEF_BB);
232 }
233
234 /*******************************************************************************
235 * Function Name : BKP_ClearFlag
236 * Description : Clears Tamper Pin Event pending flag.
237 * Input : None
238 * Output : None
239 * Return : None
240 *******************************************************************************/
241 void BKP_ClearFlag(void)
242 {
243 /* Set CTE bit to clear Tamper Pin Event flag */
244 BKP->CSR |= CSR_CTE_Set;
245 }
246
247 /*******************************************************************************
248 * Function Name : BKP_GetITStatus
249 * Description : Checks whether the Tamper Pin Interrupt has occurred or not.
250 * Input : None
251 * Output : None
252 * Return : The new state of the Tamper Pin Interrupt (SET or RESET).
253 *******************************************************************************/
254 ITStatus BKP_GetITStatus(void)
255 {
256 return (ITStatus)(*(vu32 *) CSR_TIF_BB);
257 }
258
259 /*******************************************************************************
260 * Function Name : BKP_ClearITPendingBit
261 * Description : Clears Tamper Pin Interrupt pending bit.
262 * Input : None
263 * Output : None
264 * Return : None
265 *******************************************************************************/
266 void BKP_ClearITPendingBit(void)
267 {
268 /* Set CTI bit to clear Tamper Pin Interrupt pending bit */
269 BKP->CSR |= CSR_CTI_Set;
270 }
271
272 /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
Errors: 4
Warnings: none
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -