1 /**
2 ******************************************************************************
3 * @file lib_rtc.c
4 * @author Application Team
5 * @version V4.5.0
6 * @date 2019-05-14
7 * @brief RTC library.
8 ******************************************************************************
9 * @attention
10 *
11 ******************************************************************************
12 */
13 #include "lib_rtc.h"
14
15 #define RTCPWD_KEY 0x5AA55AA5
16 #define RTCCE_SETKEY 0xA55AA55B
17 #define RTCCE_CLRKEY 0xA55AA55A
18
19 /**
20 * @brief RTC registers write protection control.
21 * @param NewState:
22 * ENABLE
23 * DISABLE
24 * @retval None
25 */
RTC_WriteProtection(uint32_t NewState)26 void RTC_WriteProtection(uint32_t NewState)
27 {
28 /* Check parameters */
29 assert_parameters(IS_FUNCTIONAL_STATE(NewState));
30
31 /* Enable RTC Write-Protection */
32 if (NewState != DISABLE)
33 {
34 RTC->PWD = RTCPWD_KEY;
35 RTC->CE = RTCCE_CLRKEY;
36 }
37 /* Disable RTC Write-Protection */
38 else
39 {
40 RTC->PWD = RTCPWD_KEY;
41 RTC->CE = RTCCE_SETKEY;
42 }
43 }
44
45 /**
46 * @brief Wait until the RTC registers (be W/R protected) are synchronized
47 * with RTC APB clock.
48 *
49 * @note The RTC Resynchronization mode is write protected, use the
50 * RTC_WriteProtection(DISABLE) before calling this function.
51 * Write-Operation process as follows:
52 * 1. RTC_WriteProtection(DISABLE);
53 * 2. RTC Registers write operation(only first write-operation be
54 * valid on the same register).
55 * 3. RTC_WriteProtection(ENABLE);
56 * 4. RTC_WaitForSynchro(); Wait until the RTC registers be
57 * synchronized by calling this function.
58 * @retval None
59 */
RTC_WaitForSynchro(void)60 void RTC_WaitForSynchro(void)
61 {
62 while (RTC->CE & RTC_CE_BSY)
63 {
64 }
65 }
66
67 /**
68 * @brief Write RTC registers(continuous/be write-protected).
69 * @param[in] StartAddr the start address of registers be written
70 * @param[in] wBuffer pointer to write
71 * @param[in] Len number of registers be written
72 * @retval None
73 */
RTC_WriteRegisters(uint32_t StartAddr,const uint32_t * wBuffer,uint8_t Len)74 void RTC_WriteRegisters(uint32_t StartAddr, const uint32_t *wBuffer, uint8_t Len)
75 {
76 uint8_t cnt;
77
78 /* Parameter check */
79 assert_parameters(IS_RTC_REGOP_STARTADDR(StartAddr));
80
81 /* Wait until the RTC registers be synchronized */
82 RTC_WaitForSynchro();
83
84 /* Disable RTC Registers write-protection */
85 RTC_WriteProtection(DISABLE);
86
87 /* Write registers */
88 for (cnt=0; cnt<Len; cnt++)
89 {
90 *(volatile uint32_t *)(StartAddr) = *(wBuffer++);
91 StartAddr += 4;
92 }
93
94 /* Enable RTC Registers write-protection */
95 RTC_WriteProtection(ENABLE);
96 /* Wait until the RTC registers be synchronized */
97 RTC_WaitForSynchro();
98 }
99
100 /**
101 * @brief Read RTC registers(continuous/be read-protected).
102 * @param[in] StartAddr the start address of registers be read
103 * @param[out] rBuffer pointer to read
104 * @param[in] Len number of registers be read
105 * @retval None
106 */
RTC_ReadRegisters(uint32_t StartAddr,uint32_t * rBuffer,uint8_t Len)107 void RTC_ReadRegisters(uint32_t StartAddr, uint32_t *rBuffer, uint8_t Len)
108 {
109 __IO uint32_t tmp;
110 uint8_t cnt;
111
112 /* Parameter check */
113 assert_parameters(IS_RTC_REGOP_STARTADDR(StartAddr));
114
115 /* Wait until the RTC registers be synchronized */
116 RTC_WaitForSynchro();
117
118 /* Dummy read-operation to RTC->LOAD */
119 tmp = RTC->LOAD;
120 tmp += 1;
121 /* Wait until the RTC registers be synchronized */
122 RTC_WaitForSynchro();
123
124 /* Read registers */
125 for (cnt=0; cnt<Len; cnt++)
126 {
127 *(rBuffer++) = *(volatile uint32_t *)(StartAddr);
128 StartAddr += 4;
129 }
130 }
131
132 /**
133 * @brief Set RTC current time.
134 * @param sTime: Pointer to Time structure
135 * @retval None
136 */
RTC_SetTime(RTC_TimeTypeDef * sTime)137 void RTC_SetTime(RTC_TimeTypeDef *sTime)
138 {
139 /* Parameter check */
140 assert_parameters(IS_RTC_TIME_YEAR(sTime->Year));
141 assert_parameters(IS_RTC_TIME_MONTH(sTime->Month));
142 assert_parameters(IS_RTC_TIME_DATE(sTime->Date));
143 assert_parameters(IS_RTC_TIME_WEEKDAY(sTime->WeekDay));
144 assert_parameters(IS_RTC_TIME_HOURS(sTime->Hours));
145 assert_parameters(IS_RTC_TIME_MINS(sTime->Minutes));
146 assert_parameters(IS_RTC_TIME_SECS(sTime->Seconds));
147
148 /* Wait until the RTC registers be synchronized */
149 RTC_WaitForSynchro();
150
151 /* Disable RTC Registers write-protection */
152 RTC_WriteProtection(DISABLE);
153
154 /* Write RTC time registers */
155 RTC->SEC = sTime->Seconds;
156 RTC->MIN = sTime->Minutes;
157 RTC->HOUR = sTime->Hours;
158 RTC->DAY = sTime->Date;
159 RTC->WEEK = sTime->WeekDay;
160 RTC->MON = sTime->Month;
161 RTC->YEAR = sTime->Year;
162
163 /* Enable RTC Registers write-protection */
164 RTC_WriteProtection(ENABLE);
165 /* Wait until the RTC registers be synchronized */
166 RTC_WaitForSynchro();
167 }
168
169 /**
170 * @brief Get RTC current time.
171 * @param gTime: Pointer to Time structure
172 * @retval None
173 */
RTC_GetTime(RTC_TimeTypeDef * gTime)174 void RTC_GetTime(RTC_TimeTypeDef *gTime)
175 {
176 __IO uint32_t dummy_data = 0;
177
178 /* Wait until the RTC registers be synchronized */
179 RTC_WaitForSynchro();
180
181 /* Dummy read-operation to RTC->LOAD register */
182 dummy_data = RTC->LOAD;
183 dummy_data += 1;
184 /* Wait until the RTC registers be synchronized */
185 RTC_WaitForSynchro();
186
187 /* Read RTC time registers */
188 gTime->Seconds = RTC->SEC;
189 gTime->Minutes = RTC->MIN;
190 gTime->Hours = RTC->HOUR;
191 gTime->Date = RTC->DAY;
192 gTime->WeekDay = RTC->WEEK;
193 gTime->Month = RTC->MON;
194 gTime->Year = RTC->YEAR;
195 }
196
197 /**
198 * @brief Interrupt configure.
199 * @param INTMask: can use the ��|�� operator
200 RTC_INT_CEILLE
201 RTC_INT_ACDONE
202 RTC_INT_WKUCNT
203 RTC_INT_MIDNIGHT
204 RTC_INT_WKUHOUR
205 RTC_INT_WKUMIN
206 RTC_INT_WKUSEC
207 RTC_INT_TIMEILLE
208 NewState:
209 ENABLE
210 DISABLE
211 * @retval None
212 */
RTC_INTConfig(uint32_t INTMask,uint32_t NewState)213 void RTC_INTConfig(uint32_t INTMask, uint32_t NewState)
214 {
215 uint32_t tmp;
216
217 /* Parameter check */
218 assert_parameters(IS_RTC_INT(INTMask));
219 assert_parameters(IS_FUNCTIONAL_STATE(NewState));
220
221 tmp = RTC->INTEN;
222 tmp &= ~(0x1UL);
223
224 if (NewState == ENABLE)
225 tmp |= INTMask;
226 else
227 tmp &= ~INTMask;
228
229 RTC->INTEN = tmp;
230 }
231
232 /**
233 * @brief Get interrupt status.
234 * @param INTMask:
235 RTC_INTSTS_CEILLE
236 RTC_INTSTS_ACDONE
237 RTC_INTSTS_WKUCNT
238 RTC_INTSTS_MIDNIGHT
239 RTC_INTSTS_WKUHOUR
240 RTC_INTSTS_WKUMIN
241 RTC_INTSTS_WKUSEC
242 RTC_INTSTS_TIMEILLE
243 * @retval 1: status set
244 0: status reset.
245 */
RTC_GetINTStatus(uint32_t FlagMask)246 uint8_t RTC_GetINTStatus(uint32_t FlagMask)
247 {
248 /* Parameter check */
249 assert_parameters(IS_RTC_INTFLAGR(FlagMask));
250
251 if (RTC->INTSTS&FlagMask)
252 {
253 return 1;
254 }
255 else
256 {
257 return 0;
258 }
259 }
260
261 /**
262 * @brief Clear interrupt status.
263 * @param INTMask: can use the ��|�� operator
264 RTC_INTSTS_CEILLE
265 RTC_INTSTS_ACDONE
266 RTC_INTSTS_WKUCNT
267 RTC_INTSTS_MIDNIGHT
268 RTC_INTSTS_WKUHOUR
269 RTC_INTSTS_WKUMIN
270 RTC_INTSTS_WKUSEC
271 RTC_INTSTS_TIMEILLE
272 * @retval None
273 */
RTC_ClearINTStatus(uint32_t FlagMask)274 void RTC_ClearINTStatus(uint32_t FlagMask)
275 {
276 /* Parameter check */
277 assert_parameters(IS_RTC_INTFLAGC(FlagMask));
278
279 RTC->INTSTS = FlagMask;
280 }
281
282 /**
283 * @brief Fills each RTCAC_InitStruct member with its default value.
284 * @param RTCAC_InitStruct: pointer to an RTC_AutCalType structure which will be initialized.
285 * @retval None
286 */
RTC_AutoCalStructInit(RTC_AutCalType * RTCAC_InitStruct)287 void RTC_AutoCalStructInit(RTC_AutCalType *RTCAC_InitStruct)
288 {
289 /*------------ Reset RTC AutCal init structure parameters values -----------*/
290 /* Initialize the ADCSource member */
291 RTCAC_InitStruct->ADCSource = RTC_ADCS_DATA;
292 /* Initialize the ATClockSource member */
293 RTCAC_InitStruct->ATClockSource = RTC_ATCS_DISABLE;
294 /* Initialize the ATDelay member */
295 RTCAC_InitStruct->ATDelay = RTC_ATDELAY_15MS;
296 /* Initialize the Period member */
297 RTCAC_InitStruct->Period = 0;
298 }
299
300 /**
301 * @brief Auto calibration initialization.
302 * @param InitStruct: pointer to AutoCal_InitType Auto calibration configuration.
303 * ATDelay:
304 * RTC_ATDELAY_15MS
305 * RTC_ATDELAY_31MS
306 * RTC_ATDELAY_62MS
307 * RTC_ATDELAY_125MS
308 * ATClockSource:
309 * RTC_ATCS_DISABLE
310 * RTC_ATCS_SEC
311 * RTC_ATCS_MIN
312 * RTC_ATCS_HOUR
313 * ADCSource:
314 * RTC_ADCS_DATA
315 * RTC_ADCS_PORT
316 * Period: 0 ~ 63
317 * @note Auto trigger period is (Period+1)*1, unit is set by ATClockSource.
318 * Auto trigger function is not valid when ATClockSource is RTC_ATCS_DISABLE.
319 * @retval None
320 */
RTC_AutoCalInit(RTC_AutCalType * InitStruct)321 void RTC_AutoCalInit(RTC_AutCalType *InitStruct)
322 {
323 uint32_t tmp;
324
325 /* Parameter check */
326 assert_parameters(IS_RTC_AUTOCAL_ATDLY(InitStruct->ATDelay));
327 assert_parameters(IS_RTC_AUTOCAL_ATCS(InitStruct->ATClockSource));
328 assert_parameters(IS_RTC_AUTOCAL_ADCSRC(InitStruct->ADCSource));
329 assert_parameters(IS_RTC_AUTOCAL_PERIOD(InitStruct->Period));
330
331 tmp = RTC->ACCTRL;
332 tmp &= ~(RTC_ACCTRL_ACPER\
333 |RTC_ACCTRL_ACDEL\
334 |RTC_ACCTRL_ACCLK\
335 |RTC_ACCTRL_ADCSEL);
336 tmp |= (InitStruct->ADCSource\
337 |InitStruct->ATClockSource\
338 |InitStruct->ATDelay\
339 |((InitStruct->Period << RTC_ACCTRL_ACPER_Pos) & RTC_ACCTRL_ACPER));
340
341 /* Wait until the RTC registers be synchronized */
342 RTC_WaitForSynchro();
343 /* Disable RTC Registers write-protection */
344 RTC_WriteProtection(DISABLE);
345 RTC->ACCTRL = tmp;
346 /* Enable RTC Registers write-protection */
347 RTC_WriteProtection(ENABLE);
348 /* Wait until the RTC registers be synchronized */
349 RTC_WaitForSynchro();
350 }
351
352 /**
353 * @brief RTC automatic calibration auto-trigger source configure.
354 * @param TrigSource:
355 * RTC_ATCS_DISABLE
356 * RTC_ATCS_SEC
357 * RTC_ATCS_MIN
358 * RTC_ATCS_HOUR
359 * Period: 0 ~ 63
360 * @retval None
361 */
RTC_TrigSourceConfig(uint32_t TrigSource,uint32_t Period)362 void RTC_TrigSourceConfig(uint32_t TrigSource, uint32_t Period)
363 {
364 uint32_t tmp;
365
366 /* Parameter check */
367 assert_parameters(IS_RTC_AUTOCAL_ATCS(TrigSource));
368 assert_parameters(IS_RTC_AUTOCAL_PERIOD(Period));
369
370 tmp = RTC->ACCTRL;
371 tmp &= ~(RTC_ACCTRL_ACPER | RTC_ACCTRL_ACCLK);
372 tmp |= (TrigSource | (Period << RTC_ACCTRL_ACPER_Pos));
373
374 /* Wait until the RTC registers be synchronized */
375 RTC_WaitForSynchro();
376 /* Disable RTC Registers write-protection */
377 RTC_WriteProtection(DISABLE);
378 RTC->ACCTRL = tmp;
379 /* Enable RTC Registers write-protection */
380 RTC_WriteProtection(ENABLE);
381 /* Wait until the RTC registers be synchronized */
382 RTC_WaitForSynchro();
383 }
384
385 /**
386 * @brief ADC Auto-calibration enable control.
387 * @note When DISABLE is selected, the automatic triggering of the RTC-auto-calibration must be turned off by calling
388 * RTC_TrigSourceConfig(RTC_ATCS_DISABLE, 0) before using this function.
389 * @param NewState:
390 * ENABLE
391 * DISABLE
392 * @retval 0: Function succeeded
393 * 1: Function failded, the automatic triggering be enabled when DISABLE selected
394 */
RTC_AutoCalCmd(uint32_t NewState)395 uint32_t RTC_AutoCalCmd(uint32_t NewState)
396 {
397 uint32_t tmp;
398
399 /* Parameter check */
400 assert_parameters(IS_FUNCTIONAL_STATE(NewState));
401
402 tmp = RTC->ACCTRL;
403 if (NewState == DISABLE)
404 {
405 if (tmp & RTC_ACCTRL_ACCLK)
406 return 1;
407 else
408 tmp &= ~RTC_ACCTRL_ACEN;
409 }
410 else
411 {
412 tmp |= RTC_ACCTRL_ACEN;
413 }
414
415 /* Wait until the RTC registers be synchronized */
416 RTC_WaitForSynchro();
417 /* Disable RTC Registers write-protection */
418 RTC_WriteProtection(DISABLE);
419
420 RTC->ACCTRL = tmp;
421
422 /* Enable RTC Registers write-protection */
423 RTC_WriteProtection(ENABLE);
424 /* Wait until the RTC registers be synchronized */
425 RTC_WaitForSynchro();
426
427 return 0;
428 }
429
430 /**
431 * @brief Start RTC Auto-calibration manually.
432 * @param None
433 * @retval None
434 */
RTC_StartAutoCalManual(void)435 void RTC_StartAutoCalManual(void)
436 {
437 /* Wait until the RTC registers be synchronized */
438 RTC_WaitForSynchro();
439 /* Disable RTC Registers write-protection */
440 RTC_WriteProtection(DISABLE);
441
442 /* manual trigger Auto-calibration */
443 RTC->ACCTRL |= RTC_ACCTRL_MANU;
444
445 /* Enable RTC Registers write-protection */
446 RTC_WriteProtection(ENABLE);
447 /* Wait until the RTC registers be synchronized */
448 RTC_WaitForSynchro();
449 }
450
451 /**
452 * @brief Wait until Auto-calibration manual is done.
453 * @param None
454 * @retval None
455 */
RTC_WaitForAutoCalManual(void)456 void RTC_WaitForAutoCalManual(void)
457 {
458 while (RTC->ACCTRL&RTC_ACCTRL_MANU)
459 {
460 }
461 }
462
463 /**
464 * @brief Get auto-calibration busy flag.
465 * @param None
466 * @retval 1 flag set
467 * 0 flag reset.
468 */
RTC_GetACBusyFlag(void)469 uint8_t RTC_GetACBusyFlag(void)
470 {
471 if (RTC->INTSTS & RTC_INTSTS_ACBSY) return (1);
472 else return (0);
473 }
474
475
476 /*
477 * @brief Multi-second wake up configure.
478 * @param nPeriod��N seconds interval.
479 * @note For the first interrupt generated by calling this function, it may
480 * have < 1 sec error if the new WKUSEC number(parameter) is not equal
481 * to current WKUSEC number. If the new WKUSEC is equal to current WKUSEC,
482 * the first interrupt time may have 0~(WKUSEC +1) variation.
483 * To avoid this problem, set an alternative parameter (like 1) by calling
484 * this function, then set the correct parameter to it.
485 * @retval None
486 */
RTC_WKUSecondsConfig(uint8_t nPeriod)487 void RTC_WKUSecondsConfig(uint8_t nPeriod)
488 {
489 /* Parameter check */
490 assert_parameters(IS_RTC_WKUSEC_PERIOD(nPeriod));
491
492 /* Wait until the RTC registers be synchronized */
493 RTC_WaitForSynchro();
494
495 /* Disable RTC Registers write-protection */
496 RTC_WriteProtection(DISABLE);
497
498 /* Write registers */
499 RTC->WKUSEC = nPeriod - 1;
500
501 /* Enable RTC Registers write-protection */
502 RTC_WriteProtection(ENABLE);
503 /* Wait until the RTC registers be synchronized */
504 RTC_WaitForSynchro();
505 }
506
507 /*
508 * @brief Multi-minute wake up configure.
509 * @param nPeriod��N minute interval.
510 * @note For the first interrupt generated by calling this function, it may
511 * have < 1 min error if the new WKUMIN number(parameter) is not equal
512 * to current WKUMIN number. If the new WKUMIN is equal to current WKUMIN,
513 * the first interrupt time may have 0~(WKUMIN +1) variation.
514 * To avoid this problem, set an alternative parameter (like 1) by calling
515 * this function, then set the correct parameter to it.
516 * @retval None
517 */
RTC_WKUMinutesConfig(uint8_t nPeriod)518 void RTC_WKUMinutesConfig(uint8_t nPeriod)
519 {
520 /* Parameter check */
521 assert_parameters(IS_RTC_WKUMIN_PERIOD(nPeriod));
522
523 /* Wait until the RTC registers be synchronized */
524 RTC_WaitForSynchro();
525
526 /* Disable RTC Registers write-protection */
527 RTC_WriteProtection(DISABLE);
528
529 /* Write registers */
530 RTC->WKUMIN = nPeriod - 1;
531
532 /* Enable RTC Registers write-protection */
533 RTC_WriteProtection(ENABLE);
534 /* Wait until the RTC registers be synchronized */
535 RTC_WaitForSynchro();
536 }
537
538 /*
539 * @brief Multi-hour wake up configure.
540 * @param nPeriod��N hour interval.
541 * @note For the first interrupt generated by calling this function, it may
542 * have < 1 hour error if the new WKUHOUR number(parameter) is not equal
543 * to current WKUHOUR number. If the new WKUHOUR is equal to current WKUHOUR,
544 * the first interrupt time may have 0~(WKUHOUR +1) variation.
545 * To avoid this problem, set an alternative parameter (like 1) by calling
546 * this function, then set the correct parameter to it.
547 * @retval None
548 */
RTC_WKUHoursConfig(uint8_t nPeriod)549 void RTC_WKUHoursConfig(uint8_t nPeriod)
550 {
551 /* Parameter check */
552 assert_parameters(IS_RTC_WKUHOUR_PERIOD(nPeriod));
553
554 /* Wait until the RTC registers be synchronized */
555 RTC_WaitForSynchro();
556
557 /* Disable RTC Registers write-protection */
558 RTC_WriteProtection(DISABLE);
559
560 /* Write registers */
561 RTC->WKUHOUR = nPeriod - 1;
562
563 /* Enable RTC Registers write-protection */
564 RTC_WriteProtection(ENABLE);
565 /* Wait until the RTC registers be synchronized */
566 RTC_WaitForSynchro();
567 }
568
569 /**
570 * @brief RTC counter wake up configure.
571 * @param nClock: 1 ~ 0x1000000
572 CNTCLK:
573 RTC_WKUCNT_RTCCLK
574 RTC_WKUCNT_2048
575 RTC_WKUCNT_512
576 RTC_WKUCNT_128
577 * @retval None
578 */
RTC_WKUCounterConfig(uint32_t nClock,uint32_t CNTCLK)579 void RTC_WKUCounterConfig(uint32_t nClock,uint32_t CNTCLK)
580 {
581 /* Parameter check */
582 assert_parameters(IS_RTC_WKUCNT_PERIOD(nClock));
583 assert_parameters(IS_RTC_WKUCNT_CNTSEL(CNTCLK));
584
585 /* Wait until the RTC registers be synchronized */
586 RTC_WaitForSynchro();
587
588 /* Disable RTC Registers write-protection */
589 RTC_WriteProtection(DISABLE);
590
591 /* Write registers */
592 RTC->WKUCNT = (CNTCLK & RTC_WKUCNT_CNTSEL) | (nClock -1 );
593
594 /* Enable RTC Registers write-protection */
595 RTC_WriteProtection(ENABLE);
596 /* Wait until the RTC registers be synchronized */
597 RTC_WaitForSynchro();
598 }
599
600 /**
601 * @brief Gets RTC wake-up counter value.
602 * @retval RTC wake-up counter value
603 */
RTC_GetWKUCounterValue(void)604 uint32_t RTC_GetWKUCounterValue(void)
605 {
606 return RTC->WKUCNTR;
607 }
608
609 /**
610 * @brief RTC clock prescaler configure.
611 * @param[in] Prescaler:
612 * RTC_CLKDIV_1
613 * RTC_CLKDIV_4
614 * @retval None
615 */
RTC_PrescalerConfig(uint32_t Prescaler)616 void RTC_PrescalerConfig(uint32_t Prescaler)
617 {
618 uint32_t tmp;
619
620 /* Parameter check */
621 assert_parameters(IS_RTC_CLKDIV(Prescaler));
622
623 tmp = RTC->PSCA;
624 tmp &= ~RTC_PSCA_PSCA;
625 tmp |= Prescaler;
626
627 /* Wait until the RTC registers be synchronized */
628 RTC_WaitForSynchro();
629 /* Disable RTC Registers write-protection */
630 RTC_WriteProtection(DISABLE);
631 RTC->PSCA = tmp;
632 /* Enable RTC Registers write-protection */
633 RTC_WriteProtection(ENABLE);
634 /* Wait until the RTC registers be synchronized */
635 RTC_WaitForSynchro();
636 }
637
638 /**
639 * @brief RTC PLLDIV frequency configure.
640 * @param nfrequency(HZ): the frequency of RTC PLLDIV output configuration.
641 * @note Ensure clocks be configured by calling function CLK_ClockConfig(),
642 * get correct PCLK frequency by calling function CLK_GetPCLKFreq().
643 * @retval None
644 */
RTC_PLLDIVConfig(uint32_t nfrequency)645 void RTC_PLLDIVConfig(uint32_t nfrequency)
646 {
647 RTC->DIV = CLK_GetPCLKFreq()/2/nfrequency - 1;
648 }
649
650 /**
651 * @brief RTC PLLDIV output enable.
652 * @param NewState:
653 * ENABLE
654 * DISABLE
655 * @retval None
656 */
RTC_PLLDIVOutputCmd(uint8_t NewState)657 void RTC_PLLDIVOutputCmd(uint8_t NewState)
658 {
659 /* Parameter check */
660 assert_parameters(IS_FUNCTIONAL_STATE(NewState));
661
662 if (NewState == ENABLE) RTC->CTL |= RTC_CTL_RTCPLLOE;
663 else RTC->CTL &= ~RTC_CTL_RTCPLLOE;
664 }
665
666
667 /*********************************** END OF FILE ******************************/
668