Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 9 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /** |
1 | /** |
2 | ****************************************************************************** |
2 | ****************************************************************************** |
3 | * @file stm32f1xx_ll_rtc.c |
3 | * @file stm32f1xx_ll_rtc.c |
4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
5 | * @brief RTC LL module driver. |
5 | * @brief RTC LL module driver. |
6 | ****************************************************************************** |
6 | ****************************************************************************** |
7 | * @attention |
7 | * @attention |
8 | * |
8 | * |
9 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
- | 10 | * All rights reserved.</center></h2> |
|
10 | * |
11 | * |
11 | * Redistribution and use in source and binary forms, with or without modification, |
12 | * This software component is licensed by ST under BSD 3-Clause license, |
12 | * are permitted provided that the following conditions are met: |
13 | * the "License"; You may not use this file except in compliance with the |
13 | * 1. Redistributions of source code must retain the above copyright notice, |
- | |
14 | * this list of conditions and the following disclaimer. |
- | |
15 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
- | |
16 | * this list of conditions and the following disclaimer in the documentation |
- | |
17 | * and/or other materials provided with the distribution. |
14 | * License. You may obtain a copy of the License at: |
18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
- | |
19 | * may be used to endorse or promote products derived from this software |
15 | * opensource.org/licenses/BSD-3-Clause |
20 | * without specific prior written permission. |
- | |
21 | * |
- | |
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
- | |
23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
- | |
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
- | |
25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
- | |
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
- | |
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
- | |
28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
- | |
29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
- | |
30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
- | |
31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
- | |
32 | * |
16 | * |
33 | ****************************************************************************** |
17 | ****************************************************************************** |
34 | */ |
18 | */ |
- | 19 | ||
35 | #if defined(USE_FULL_LL_DRIVER) |
20 | #if defined(USE_FULL_LL_DRIVER) |
36 | 21 | ||
37 | /* Includes ------------------------------------------------------------------*/ |
22 | /* Includes ------------------------------------------------------------------*/ |
38 | #include "stm32f1xx_ll_rtc.h" |
23 | #include "stm32f1xx_ll_rtc.h" |
39 | #include "stm32f1xx_ll_cortex.h" |
24 | #include "stm32f1xx_ll_cortex.h" |
Line 83... | Line 68... | ||
83 | #define IS_LL_RTC_MINUTES(__MINUTES__) ((__MINUTES__) <= 59U) |
68 | #define IS_LL_RTC_MINUTES(__MINUTES__) ((__MINUTES__) <= 59U) |
84 | #define IS_LL_RTC_SECONDS(__SECONDS__) ((__SECONDS__) <= 59U) |
69 | #define IS_LL_RTC_SECONDS(__SECONDS__) ((__SECONDS__) <= 59U) |
85 | #define IS_LL_RTC_CALIB_OUTPUT(__OUTPUT__) (((__OUTPUT__) == LL_RTC_CALIB_OUTPUT_NONE) || \ |
70 | #define IS_LL_RTC_CALIB_OUTPUT(__OUTPUT__) (((__OUTPUT__) == LL_RTC_CALIB_OUTPUT_NONE) || \ |
86 | ((__OUTPUT__) == LL_RTC_CALIB_OUTPUT_RTCCLOCK) || \ |
71 | ((__OUTPUT__) == LL_RTC_CALIB_OUTPUT_RTCCLOCK) || \ |
87 | ((__OUTPUT__) == LL_RTC_CALIB_OUTPUT_ALARM) || \ |
72 | ((__OUTPUT__) == LL_RTC_CALIB_OUTPUT_ALARM) || \ |
88 | ((__OUTPUT__) == LL_RTC_CALIB_OUTPUT_SECOND)) |
73 | ((__OUTPUT__) == LL_RTC_CALIB_OUTPUT_SECOND)) |
89 | /** |
74 | /** |
90 | * @} |
75 | * @} |
91 | */ |
76 | */ |
92 | /* Private function prototypes -----------------------------------------------*/ |
77 | /* Private function prototypes -----------------------------------------------*/ |
93 | /* Exported functions --------------------------------------------------------*/ |
78 | /* Exported functions --------------------------------------------------------*/ |
Line 119... | Line 104... | ||
119 | LL_RTC_DisableWriteProtection(RTCx); |
104 | LL_RTC_DisableWriteProtection(RTCx); |
120 | 105 | ||
121 | /* Set Initialization mode */ |
106 | /* Set Initialization mode */ |
122 | if (LL_RTC_EnterInitMode(RTCx) != ERROR) |
107 | if (LL_RTC_EnterInitMode(RTCx) != ERROR) |
123 | { |
108 | { |
124 | LL_RTC_WriteReg(RTCx,CNTL, 0x0000); |
109 | LL_RTC_WriteReg(RTCx, CNTL, 0x0000); |
125 | LL_RTC_WriteReg(RTCx,CNTH, 0x0000); |
110 | LL_RTC_WriteReg(RTCx, CNTH, 0x0000); |
126 | LL_RTC_WriteReg(RTCx,PRLH, 0x0000); |
111 | LL_RTC_WriteReg(RTCx, PRLH, 0x0000); |
127 | LL_RTC_WriteReg(RTCx,PRLL, 0x8000); |
112 | LL_RTC_WriteReg(RTCx, PRLL, 0x8000); |
128 | LL_RTC_WriteReg(RTCx,CRH, 0x0000); |
113 | LL_RTC_WriteReg(RTCx, CRH, 0x0000); |
129 | LL_RTC_WriteReg(RTCx,CRL, 0x0020); |
114 | LL_RTC_WriteReg(RTCx, CRL, 0x0020); |
130 | 115 | ||
131 | /* Reset Tamper and alternate functions configuration register */ |
116 | /* Reset Tamper and alternate functions configuration register */ |
132 | LL_RTC_WriteReg(BKP,RTCCR, 0x00000000U); |
117 | LL_RTC_WriteReg(BKP, RTCCR, 0x00000000U); |
133 | LL_RTC_WriteReg(BKP,CR, 0x00000000U); |
118 | LL_RTC_WriteReg(BKP, CR, 0x00000000U); |
134 | LL_RTC_WriteReg(BKP,CSR, 0x00000000U); |
119 | LL_RTC_WriteReg(BKP, CSR, 0x00000000U); |
135 | 120 | ||
136 | /* Exit Initialization Mode */ |
121 | /* Exit Initialization Mode */ |
137 | if(LL_RTC_ExitInitMode(RTCx) == ERROR) |
122 | if (LL_RTC_ExitInitMode(RTCx) != ERROR) |
138 | { |
123 | { |
- | 124 | /* Wait till the RTC RSF flag is set */ |
|
- | 125 | status = LL_RTC_WaitForSynchro(RTCx); |
|
- | 126 | ||
139 | return ERROR; |
127 | /* Clear RSF Flag */ |
- | 128 | LL_RTC_ClearFlag_RS(RTCx); |
|
- | 129 | ||
- | 130 | /* Enable the write protection for RTC registers */ |
|
- | 131 | LL_RTC_EnableWriteProtection(RTCx); |
|
140 | } |
132 | } |
141 | - | ||
142 | /* Wait till the RTC RSF flag is set */ |
- | |
143 | status = LL_RTC_WaitForSynchro(RTCx); |
- | |
144 | - | ||
145 | /* Clear RSF Flag */ |
- | |
146 | LL_RTC_ClearFlag_RS(RTCx); |
- | |
147 | } |
133 | } |
- | 134 | else |
|
148 | 135 | { |
|
149 | /* Enable the write protection for RTC registers */ |
136 | /* Enable the write protection for RTC registers */ |
150 | LL_RTC_EnableWriteProtection(RTCx); |
137 | LL_RTC_EnableWriteProtection(RTCx); |
- | 138 | } |
|
151 | 139 | ||
152 | return status; |
140 | return status; |
153 | } |
141 | } |
154 | 142 | ||
155 | /** |
143 | /** |
Line 173... | Line 161... | ||
173 | /* Check the parameters */ |
161 | /* Check the parameters */ |
174 | assert_param(IS_RTC_ALL_INSTANCE(RTCx)); |
162 | assert_param(IS_RTC_ALL_INSTANCE(RTCx)); |
175 | assert_param(IS_LL_RTC_ASYNCH_PREDIV(RTC_InitStruct->AsynchPrescaler)); |
163 | assert_param(IS_LL_RTC_ASYNCH_PREDIV(RTC_InitStruct->AsynchPrescaler)); |
176 | assert_param(IS_LL_RTC_CALIB_OUTPUT(RTC_InitStruct->OutPutSource)); |
164 | assert_param(IS_LL_RTC_CALIB_OUTPUT(RTC_InitStruct->OutPutSource)); |
177 | /* Waiting for synchro */ |
165 | /* Waiting for synchro */ |
178 | if(LL_RTC_WaitForSynchro(RTCx) != ERROR) |
166 | if (LL_RTC_WaitForSynchro(RTCx) != ERROR) |
179 | { |
167 | { |
180 | /* Set Initialization mode */ |
168 | /* Set Initialization mode */ |
181 | if (LL_RTC_EnterInitMode(RTCx) != ERROR) |
169 | if (LL_RTC_EnterInitMode(RTCx) != ERROR) |
182 | { |
170 | { |
183 | /* Clear Flag Bits */ |
171 | /* Clear Flag Bits */ |
184 | LL_RTC_ClearFlag_ALR(RTCx); |
172 | LL_RTC_ClearFlag_ALR(RTCx); |
185 | LL_RTC_ClearFlag_OW(RTCx); |
173 | LL_RTC_ClearFlag_OW(RTCx); |
186 | LL_RTC_ClearFlag_SEC(RTCx); |
174 | LL_RTC_ClearFlag_SEC(RTCx); |
187 | 175 | ||
188 | if(RTC_InitStruct->OutPutSource != LL_RTC_CALIB_OUTPUT_NONE) |
176 | if (RTC_InitStruct->OutPutSource != LL_RTC_CALIB_OUTPUT_NONE) |
189 | { |
177 | { |
190 | /* Disable the selected Tamper Pin */ |
178 | /* Disable the selected Tamper Pin */ |
191 | LL_RTC_TAMPER_Disable(BKP); |
179 | LL_RTC_TAMPER_Disable(BKP); |
192 | } |
180 | } |
193 | /* Set the signal which will be routed to RTC Tamper Pin */ |
181 | /* Set the signal which will be routed to RTC Tamper Pin */ |
194 | LL_RTC_SetOutputSource(BKP, RTC_InitStruct->OutPutSource); |
182 | LL_RTC_SetOutputSource(BKP, RTC_InitStruct->OutPutSource); |
195 | 183 | ||
196 | /* Configure Synchronous and Asynchronous prescaler factor */ |
184 | /* Configure Synchronous and Asynchronous prescaler factor */ |
197 | LL_RTC_SetAsynchPrescaler(RTCx, RTC_InitStruct->AsynchPrescaler); |
185 | LL_RTC_SetAsynchPrescaler(RTCx, RTC_InitStruct->AsynchPrescaler); |
198 | 186 | ||
199 | /* Exit Initialization Mode */ |
187 | /* Exit Initialization Mode */ |
200 | LL_RTC_ExitInitMode(RTCx); |
188 | LL_RTC_ExitInitMode(RTCx); |
201 | 189 | ||
202 | status = SUCCESS; |
190 | status = SUCCESS; |
203 | } |
191 | } |
204 | } |
192 | } |
205 | return status; |
193 | return status; |
206 | } |
194 | } |
Line 223... | Line 211... | ||
223 | * @param RTC_Format This parameter can be one of the following values: |
211 | * @param RTC_Format This parameter can be one of the following values: |
224 | * @arg @ref LL_RTC_FORMAT_BIN |
212 | * @arg @ref LL_RTC_FORMAT_BIN |
225 | * @arg @ref LL_RTC_FORMAT_BCD |
213 | * @arg @ref LL_RTC_FORMAT_BCD |
226 | * @param RTC_TimeStruct pointer to a RTC_TimeTypeDef structure that contains |
214 | * @param RTC_TimeStruct pointer to a RTC_TimeTypeDef structure that contains |
227 | * the time configuration information for the RTC. |
215 | * the time configuration information for the RTC. |
228 | * @note The user should call LL_RTC_TIME_StructInit() or the structure |
216 | * @note The user should call LL_RTC_TIME_StructInit() or the structure |
229 | * of time need to be initialized before time init() |
217 | * of time need to be initialized before time init() |
230 | * @retval An ErrorStatus enumeration value: |
218 | * @retval An ErrorStatus enumeration value: |
231 | * - SUCCESS: RTC Time register is configured |
219 | * - SUCCESS: RTC Time register is configured |
232 | * - ERROR: RTC Time register is not configured |
220 | * - ERROR: RTC Time register is not configured |
233 | */ |
221 | */ |
Line 257... | Line 245... | ||
257 | if (LL_RTC_EnterInitMode(RTCx) != ERROR) |
245 | if (LL_RTC_EnterInitMode(RTCx) != ERROR) |
258 | { |
246 | { |
259 | /* Check the input parameters format */ |
247 | /* Check the input parameters format */ |
260 | if (RTC_Format != LL_RTC_FORMAT_BIN) |
248 | if (RTC_Format != LL_RTC_FORMAT_BIN) |
261 | { |
249 | { |
262 | counter_time = (uint32_t)(((uint32_t)RTC_TimeStruct->Hours * 3600U) + \ |
250 | counter_time = (uint32_t)(((uint32_t)RTC_TimeStruct->Hours * 3600U) + \ |
263 | ((uint32_t)RTC_TimeStruct->Minutes * 60U) + \ |
251 | ((uint32_t)RTC_TimeStruct->Minutes * 60U) + \ |
264 | ((uint32_t)RTC_TimeStruct->Seconds)); |
252 | ((uint32_t)RTC_TimeStruct->Seconds)); |
265 | LL_RTC_TIME_Set(RTCx, counter_time); |
253 | LL_RTC_TIME_Set(RTCx, counter_time); |
266 | } |
254 | } |
267 | else |
255 | else |
268 | { |
256 | { |
269 | counter_time = (((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_TimeStruct->Hours)) * 3600U) + \ |
257 | counter_time = (((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_TimeStruct->Hours)) * 3600U) + \ |
270 | ((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_TimeStruct->Minutes)) * 60U) + \ |
258 | ((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_TimeStruct->Minutes)) * 60U) + \ |
271 | ((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_TimeStruct->Seconds)))); |
259 | ((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_TimeStruct->Seconds)))); |
272 | LL_RTC_TIME_Set(RTCx, counter_time); |
260 | LL_RTC_TIME_Set(RTCx, counter_time); |
273 | } |
261 | } |
274 | status = SUCCESS; |
262 | status = SUCCESS; |
275 | } |
263 | } |
276 | /* Exit Initialization mode */ |
264 | /* Exit Initialization mode */ |
Line 298... | Line 286... | ||
298 | * @param RTC_Format This parameter can be one of the following values: |
286 | * @param RTC_Format This parameter can be one of the following values: |
299 | * @arg @ref LL_RTC_FORMAT_BIN |
287 | * @arg @ref LL_RTC_FORMAT_BIN |
300 | * @arg @ref LL_RTC_FORMAT_BCD |
288 | * @arg @ref LL_RTC_FORMAT_BCD |
301 | * @param RTC_AlarmStruct pointer to a @ref LL_RTC_AlarmTypeDef structure that |
289 | * @param RTC_AlarmStruct pointer to a @ref LL_RTC_AlarmTypeDef structure that |
302 | * contains the alarm configuration parameters. |
290 | * contains the alarm configuration parameters. |
303 | * @note the user should call LL_RTC_ALARM_StructInit() or the structure |
291 | * @note the user should call LL_RTC_ALARM_StructInit() or the structure |
304 | * of Alarm need to be initialized before Alarm init() |
292 | * of Alarm need to be initialized before Alarm init() |
305 | * @retval An ErrorStatus enumeration value: |
293 | * @retval An ErrorStatus enumeration value: |
306 | * - SUCCESS: ALARM registers are configured |
294 | * - SUCCESS: ALARM registers are configured |
307 | * - ERROR: ALARM registers are not configured |
295 | * - ERROR: ALARM registers are not configured |
308 | */ |
296 | */ |
Line 331... | Line 319... | ||
331 | if (LL_RTC_EnterInitMode(RTCx) != ERROR) |
319 | if (LL_RTC_EnterInitMode(RTCx) != ERROR) |
332 | { |
320 | { |
333 | /* Check the input parameters format */ |
321 | /* Check the input parameters format */ |
334 | if (RTC_Format != LL_RTC_FORMAT_BIN) |
322 | if (RTC_Format != LL_RTC_FORMAT_BIN) |
335 | { |
323 | { |
336 | counter_alarm = (uint32_t)(((uint32_t)RTC_AlarmStruct->AlarmTime.Hours * 3600U) + \ |
324 | counter_alarm = (uint32_t)(((uint32_t)RTC_AlarmStruct->AlarmTime.Hours * 3600U) + \ |
337 | ((uint32_t)RTC_AlarmStruct->AlarmTime.Minutes * 60U) + \ |
325 | ((uint32_t)RTC_AlarmStruct->AlarmTime.Minutes * 60U) + \ |
338 | ((uint32_t)RTC_AlarmStruct->AlarmTime.Seconds)); |
326 | ((uint32_t)RTC_AlarmStruct->AlarmTime.Seconds)); |
339 | LL_RTC_ALARM_Set(RTCx, counter_alarm); |
327 | LL_RTC_ALARM_Set(RTCx, counter_alarm); |
340 | } |
328 | } |
341 | else |
329 | else |
342 | { |
330 | { |
343 | counter_alarm = (((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_AlarmStruct->AlarmTime.Hours)) * 3600U) + \ |
331 | counter_alarm = (((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_AlarmStruct->AlarmTime.Hours)) * 3600U) + \ |
344 | ((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_AlarmStruct->AlarmTime.Minutes)) * 60U) + \ |
332 | ((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_AlarmStruct->AlarmTime.Minutes)) * 60U) + \ |
345 | ((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_AlarmStruct->AlarmTime.Seconds)))); |
333 | ((uint32_t)(__LL_RTC_CONVERT_BCD2BIN(RTC_AlarmStruct->AlarmTime.Seconds)))); |
346 | LL_RTC_ALARM_Set(RTCx, counter_alarm); |
334 | LL_RTC_ALARM_Set(RTCx, counter_alarm); |
347 | } |
335 | } |
348 | status = SUCCESS; |
336 | status = SUCCESS; |
349 | } |
337 | } |
350 | /* Exit Initialization mode */ |
338 | /* Exit Initialization mode */ |
Line 381... | Line 369... | ||
381 | uint32_t tmp = 0U; |
369 | uint32_t tmp = 0U; |
382 | 370 | ||
383 | /* Check the parameter */ |
371 | /* Check the parameter */ |
384 | assert_param(IS_RTC_ALL_INSTANCE(RTCx)); |
372 | assert_param(IS_RTC_ALL_INSTANCE(RTCx)); |
385 | 373 | ||
386 | /* Wait till RTC is in INIT state and if Time out is reached exit */ |
374 | /* Wait till RTC is in INIT state and if Time out is reached exit */ |
- | 375 | tmp = LL_RTC_IsActiveFlag_RTOF(RTCx); |
|
- | 376 | while ((timeout != 0U) && (tmp != 1U)) |
|
- | 377 | { |
|
- | 378 | if (LL_SYSTICK_IsActiveCounterFlag() == 1U) |
|
- | 379 | { |
|
- | 380 | timeout --; |
|
- | 381 | } |
|
387 | tmp = LL_RTC_IsActiveFlag_RTOF(RTCx); |
382 | tmp = LL_RTC_IsActiveFlag_RTOF(RTCx); |
388 | while ((timeout != 0U) && (tmp != 1U)) |
383 | if (timeout == 0U) |
389 | { |
384 | { |
390 | if (LL_SYSTICK_IsActiveCounterFlag() == 1U) |
- | |
391 | { |
- | |
392 | timeout --; |
- | |
393 | } |
- | |
394 | tmp = LL_RTC_IsActiveFlag_RTOF(RTCx); |
- | |
395 | if (timeout == 0U) |
- | |
396 | { |
- | |
397 | status = ERROR; |
385 | status = ERROR; |
398 | } |
- | |
399 | } |
386 | } |
- | 387 | } |
|
400 | 388 | ||
401 | /* Disable the write protection for RTC registers */ |
389 | /* Disable the write protection for RTC registers */ |
402 | LL_RTC_DisableWriteProtection(RTCx); |
390 | LL_RTC_DisableWriteProtection(RTCx); |
403 | 391 | ||
404 | return status; |
392 | return status; |
405 | } |
393 | } |
406 | 394 | ||
407 | /** |
395 | /** |
408 | * @brief Exit the RTC Initialization mode. |
396 | * @brief Exit the RTC Initialization mode. |
Line 416... | Line 404... | ||
416 | ErrorStatus LL_RTC_ExitInitMode(RTC_TypeDef *RTCx) |
404 | ErrorStatus LL_RTC_ExitInitMode(RTC_TypeDef *RTCx) |
417 | { |
405 | { |
418 | __IO uint32_t timeout = RTC_INITMODE_TIMEOUT; |
406 | __IO uint32_t timeout = RTC_INITMODE_TIMEOUT; |
419 | ErrorStatus status = SUCCESS; |
407 | ErrorStatus status = SUCCESS; |
420 | uint32_t tmp = 0U; |
408 | uint32_t tmp = 0U; |
421 | 409 | ||
422 | /* Check the parameter */ |
410 | /* Check the parameter */ |
423 | assert_param(IS_RTC_ALL_INSTANCE(RTCx)); |
411 | assert_param(IS_RTC_ALL_INSTANCE(RTCx)); |
424 | 412 | ||
425 | /* Disable initialization mode */ |
413 | /* Disable initialization mode */ |
426 | LL_RTC_EnableWriteProtection(RTCx); |
414 | LL_RTC_EnableWriteProtection(RTCx); |
427 | 415 | ||
428 | /* Wait till RTC is in INIT state and if Time out is reached exit */ |
416 | /* Wait till RTC is in INIT state and if Time out is reached exit */ |
429 | tmp = LL_RTC_IsActiveFlag_RTOF(RTCx); |
417 | tmp = LL_RTC_IsActiveFlag_RTOF(RTCx); |
430 | while ((timeout != 0U) && (tmp != 1U)) |
418 | while ((timeout != 0U) && (tmp != 1U)) |
431 | { |
419 | { |
432 | if (LL_SYSTICK_IsActiveCounterFlag() == 1U) |
420 | if (LL_SYSTICK_IsActiveCounterFlag() == 1U) |
Line 457... | Line 445... | ||
457 | assert_param(IS_RTC_ALL_INSTANCE(RTCx)); |
445 | assert_param(IS_RTC_ALL_INSTANCE(RTCx)); |
458 | 446 | ||
459 | /* Enter Initialization mode */ |
447 | /* Enter Initialization mode */ |
460 | if (LL_RTC_EnterInitMode(RTCx) != ERROR) |
448 | if (LL_RTC_EnterInitMode(RTCx) != ERROR) |
461 | { |
449 | { |
462 | LL_RTC_TIME_Set(RTCx, TimeCounter); |
450 | LL_RTC_TIME_Set(RTCx, TimeCounter); |
463 | status = SUCCESS; |
451 | status = SUCCESS; |
464 | } |
452 | } |
465 | /* Exit Initialization mode */ |
453 | /* Exit Initialization mode */ |
466 | LL_RTC_ExitInitMode(RTCx); |
454 | LL_RTC_ExitInitMode(RTCx); |
467 | 455 | ||
468 | return status; |
456 | return status; |
469 | } |
457 | } |
470 | 458 | ||
471 | /** |
459 | /** |
472 | * @brief Set Alarm Counter. |
460 | * @brief Set Alarm Counter. |
Line 483... | Line 471... | ||
483 | assert_param(IS_RTC_ALL_INSTANCE(RTCx)); |
471 | assert_param(IS_RTC_ALL_INSTANCE(RTCx)); |
484 | 472 | ||
485 | /* Enter Initialization mode */ |
473 | /* Enter Initialization mode */ |
486 | if (LL_RTC_EnterInitMode(RTCx) != ERROR) |
474 | if (LL_RTC_EnterInitMode(RTCx) != ERROR) |
487 | { |
475 | { |
488 | LL_RTC_ALARM_Set(RTCx, AlarmCounter); |
476 | LL_RTC_ALARM_Set(RTCx, AlarmCounter); |
489 | status = SUCCESS; |
477 | status = SUCCESS; |
490 | } |
478 | } |
491 | /* Exit Initialization mode */ |
479 | /* Exit Initialization mode */ |
492 | LL_RTC_ExitInitMode(RTCx); |
480 | LL_RTC_ExitInitMode(RTCx); |
493 | 481 | ||
494 | return status; |
482 | return status; |