STM32F4xx HAL Documentation
Hardware Abstraction Layer for STM32F4 familiy
Loading...
Searching...
No Matches
stm32f4xx_hal_rtc_ex.c
Go to the documentation of this file.
1
125/* Includes ------------------------------------------------------------------*/
126#include "stm32f4xx_hal.h"
127
137#ifdef HAL_RTC_MODULE_ENABLED
138
139/* Private typedef -----------------------------------------------------------*/
140/* Private define ------------------------------------------------------------*/
141/* Private macro -------------------------------------------------------------*/
142/* Private variables ---------------------------------------------------------*/
143/* Private function prototypes -----------------------------------------------*/
144/* Exported functions --------------------------------------------------------*/
145
186HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t RTC_TimeStampEdge, uint32_t RTC_TimeStampPin)
187{
188 uint32_t tmpreg = 0U;
189
190 /* Check the parameters */
191 assert_param(IS_TIMESTAMP_EDGE(RTC_TimeStampEdge));
192 assert_param(IS_RTC_TIMESTAMP_PIN(RTC_TimeStampPin));
193
194 /* Process Locked */
195 __HAL_LOCK(hrtc);
196
197 /* Change RTC state to BUSY */
199
200 hrtc->Instance->TAFCR &= (uint32_t)~RTC_TAFCR_TSINSEL;
201 hrtc->Instance->TAFCR |= (uint32_t)(RTC_TimeStampPin);
202
203 /* Get the RTC_CR register and clear the bits to be configured */
204 tmpreg = (uint32_t)(hrtc->Instance->CR & (uint32_t)~(RTC_CR_TSEDGE | RTC_CR_TSE));
205
206 /* Configure the Timestamp TSEDGE bit */
207 tmpreg |= RTC_TimeStampEdge;
208
209 /* Disable the write protection for RTC registers */
211
212 /* Copy the desired configuration into the CR register */
213 hrtc->Instance->CR = (uint32_t)tmpreg;
214
215 /* Clear RTC Timestamp flag */
217
218 /* Clear RTC Timestamp overrun Flag */
220
221 /* Enable the Timestamp saving */
223
224 /* Enable the write protection for RTC registers */
226
227 /* Change RTC state back to READY */
229
230 /* Process Unlocked */
231 __HAL_UNLOCK(hrtc);
232
233 return HAL_OK;
234}
235
258HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t RTC_TimeStampEdge, uint32_t RTC_TimeStampPin)
259{
260 uint32_t tmpreg = 0U;
261
262 /* Check the parameters */
263 assert_param(IS_TIMESTAMP_EDGE(RTC_TimeStampEdge));
264 assert_param(IS_RTC_TIMESTAMP_PIN(RTC_TimeStampPin));
265
266 /* Process Locked */
267 __HAL_LOCK(hrtc);
268
269 /* Change RTC state to BUSY */
271
272 hrtc->Instance->TAFCR &= (uint32_t)~RTC_TAFCR_TSINSEL;
273 hrtc->Instance->TAFCR |= (uint32_t)(RTC_TimeStampPin);
274
275 /* Get the RTC_CR register and clear the bits to be configured */
276 tmpreg = (uint32_t)(hrtc->Instance->CR & (uint32_t)~(RTC_CR_TSEDGE | RTC_CR_TSE));
277
278 /* Configure the Timestamp TSEDGE bit */
279 tmpreg |= RTC_TimeStampEdge;
280
281 /* Disable the write protection for RTC registers */
283
284 /* Copy the desired configuration into the CR register */
285 hrtc->Instance->CR = (uint32_t)tmpreg;
286
287 /* Clear RTC Timestamp flag */
289
290 /* Clear RTC Timestamp overrun Flag */
292
293 /* Enable the Timestamp saving */
295
296 /* Enable IT Timestamp */
298
299 /* Enable the write protection for RTC registers */
301
302 /* RTC Timestamp Interrupt Configuration: EXTI configuration */
305
306 /* Change RTC state back to READY */
308
309 /* Process Unlocked */
310 __HAL_UNLOCK(hrtc);
311
312 return HAL_OK;
313}
314
322{
323 uint32_t tmpreg = 0U;
324
325 /* Process Locked */
326 __HAL_LOCK(hrtc);
327
329
330 /* Disable the write protection for RTC registers */
332
333 /* In case of interrupt mode is used, the interrupt source must disabled */
335
336 /* Get the RTC_CR register and clear the bits to be configured */
337 tmpreg = (uint32_t)(hrtc->Instance->CR & (uint32_t)~(RTC_CR_TSEDGE | RTC_CR_TSE));
338
339 /* Configure the Timestamp TSEDGE and Enable bits */
340 hrtc->Instance->CR = (uint32_t)tmpreg;
341
342 /* Enable the write protection for RTC registers */
344
346
347 /* Process Unlocked */
348 __HAL_UNLOCK(hrtc);
349
350 return HAL_OK;
351}
352
366{
367 uint32_t tmptime = 0U;
368 uint32_t tmpdate = 0U;
369
370 /* Check the parameters */
372
373 /* Get the Timestamp time and date registers values */
374 tmptime = (uint32_t)(hrtc->Instance->TSTR & RTC_TR_RESERVED_MASK);
375 tmpdate = (uint32_t)(hrtc->Instance->TSDR & RTC_DR_RESERVED_MASK);
376
377 /* Fill the Time structure fields with the read parameters */
378 sTimeStamp->Hours = (uint8_t)((tmptime & (RTC_TSTR_HT | RTC_TSTR_HU)) >> RTC_TSTR_HU_Pos);
379 sTimeStamp->Minutes = (uint8_t)((tmptime & (RTC_TSTR_MNT | RTC_TSTR_MNU)) >> RTC_TSTR_MNU_Pos);
380 sTimeStamp->Seconds = (uint8_t)((tmptime & (RTC_TSTR_ST | RTC_TSTR_SU)) >> RTC_TSTR_SU_Pos);
381 sTimeStamp->TimeFormat = (uint8_t)((tmptime & (RTC_TSTR_PM)) >> RTC_TSTR_PM_Pos);
382 sTimeStamp->SubSeconds = (uint32_t) hrtc->Instance->TSSSR;
383
384 /* Fill the Date structure fields with the read parameters */
385 sTimeStampDate->Year = 0U;
386 sTimeStampDate->Month = (uint8_t)((tmpdate & (RTC_TSDR_MT | RTC_TSDR_MU)) >> RTC_TSDR_MU_Pos);
387 sTimeStampDate->Date = (uint8_t)((tmpdate & (RTC_TSDR_DT | RTC_TSDR_DU)) >> RTC_TSDR_DU_Pos);
388 sTimeStampDate->WeekDay = (uint8_t)((tmpdate & (RTC_TSDR_WDU)) >> RTC_TSDR_WDU_Pos);
389
390 /* Check the input parameters format */
391 if (Format == RTC_FORMAT_BIN)
392 {
393 /* Convert the Timestamp structure parameters to Binary format */
394 sTimeStamp->Hours = (uint8_t)RTC_Bcd2ToByte(sTimeStamp->Hours);
395 sTimeStamp->Minutes = (uint8_t)RTC_Bcd2ToByte(sTimeStamp->Minutes);
396 sTimeStamp->Seconds = (uint8_t)RTC_Bcd2ToByte(sTimeStamp->Seconds);
397
398 /* Convert the DateTimeStamp structure parameters to Binary format */
399 sTimeStampDate->Month = (uint8_t)RTC_Bcd2ToByte(sTimeStampDate->Month);
400 sTimeStampDate->Date = (uint8_t)RTC_Bcd2ToByte(sTimeStampDate->Date);
401 sTimeStampDate->WeekDay = (uint8_t)RTC_Bcd2ToByte(sTimeStampDate->WeekDay);
402 }
403
404 /* Clear the Timestamp Flag */
406
407 return HAL_OK;
408}
409
419{
420 uint32_t tmpreg = 0U;
421
422 /* Check the parameters */
432
433 /* Process Locked */
434 __HAL_LOCK(hrtc);
435
437
438 /* Copy control register into temporary variable */
439 tmpreg = hrtc->Instance->TAFCR;
440
441 /* Enable selected tamper */
442 tmpreg |= (sTamper->Tamper);
443
444 /* Configure the tamper trigger bit (this bit is just on the right of the
445 tamper enable bit, hence the one-time right shift before updating it) */
447 {
448 /* Set the tamper trigger bit (case of falling edge or high level) */
449 tmpreg |= (uint32_t)(sTamper->Tamper << 1U);
450 }
451 else
452 {
453 /* Clear the tamper trigger bit (case of rising edge or low level) */
454 tmpreg &= (uint32_t)~(sTamper->Tamper << 1U);
455 }
456
457 /* Clear remaining fields before setting them */
458 tmpreg &= ~(RTC_TAMPERFILTER_MASK | \
462 RTC_TAFCR_TAMP1INSEL | \
464
465 /* Set remaining parameters of desired configuration into temporary variable */
466 tmpreg |= ((uint32_t)sTamper->Filter | \
467 (uint32_t)sTamper->SamplingFrequency | \
468 (uint32_t)sTamper->PrechargeDuration | \
469 (uint32_t)sTamper->TamperPullUp | \
470 (uint32_t)sTamper->PinSelection | \
471 (uint32_t)sTamper->TimeStampOnTamperDetection);
472
473 /* Disable tamper global interrupt in case it is enabled */
474 tmpreg &= (uint32_t)~RTC_TAFCR_TAMPIE;
475
476 /* Copy desired configuration into configuration register */
477 hrtc->Instance->TAFCR = tmpreg;
478
480
481 /* Process Unlocked */
482 __HAL_UNLOCK(hrtc);
483
484 return HAL_OK;
485}
486
496{
497 uint32_t tmpreg = 0U;
498
499 /* Check the parameters */
509
510 /* Process Locked */
511 __HAL_LOCK(hrtc);
512
514
515 /* Copy control register into temporary variable */
516 tmpreg = hrtc->Instance->TAFCR;
517
518 /* Enable selected tamper */
519 tmpreg |= (sTamper->Tamper);
520
521 /* Configure the tamper trigger bit (this bit is just on the right of the
522 tamper enable bit, hence the one-time right shift before updating it) */
524 {
525 /* Set the tamper trigger bit (case of falling edge or high level) */
526 tmpreg |= (uint32_t)(sTamper->Tamper << 1U);
527 }
528 else
529 {
530 /* Clear the tamper trigger bit (case of rising edge or low level) */
531 tmpreg &= (uint32_t)~(sTamper->Tamper << 1U);
532 }
533
534 /* Clear remaining fields before setting them */
535 tmpreg &= ~(RTC_TAMPERFILTER_MASK | \
539 RTC_TAFCR_TAMP1INSEL | \
541
542 /* Set remaining parameters of desired configuration into temporary variable */
543 tmpreg |= ((uint32_t)sTamper->Filter | \
544 (uint32_t)sTamper->SamplingFrequency | \
545 (uint32_t)sTamper->PrechargeDuration | \
546 (uint32_t)sTamper->TamperPullUp | \
547 (uint32_t)sTamper->PinSelection | \
548 (uint32_t)sTamper->TimeStampOnTamperDetection);
549
550 /* Enable global tamper interrupt */
551 tmpreg |= (uint32_t)RTC_TAFCR_TAMPIE;
552
553 /* Copy desired configuration into configuration register */
554 hrtc->Instance->TAFCR = tmpreg;
555
556 /* RTC Tamper Interrupt Configuration: EXTI configuration */
559
561
562 /* Process Unlocked */
563 __HAL_UNLOCK(hrtc);
564
565 return HAL_OK;
566}
567
581{
583
584 /* Process Locked */
585 __HAL_LOCK(hrtc);
586
588
589 /* Disable the selected Tamper pin */
590 hrtc->Instance->TAFCR &= (uint32_t)~Tamper;
591
593
594 /* Process Unlocked */
595 __HAL_UNLOCK(hrtc);
596
597 return HAL_OK;
598}
599
607{
608 /* Clear the EXTI's Flag for RTC Timestamp and Tamper */
610
611 /* Get the Timestamp interrupt source enable status */
613 {
614 /* Get the pending status of the Timestamp Interrupt */
616 {
617 /* Timestamp callback */
618#if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
619 hrtc->TimeStampEventCallback(hrtc);
620#else
622#endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
623
624 /* Clear the Timestamp interrupt pending bit after returning from callback
625 as RTC_TSTR and RTC_TSDR registers are cleared when TSF bit is reset */
627 }
628 }
629
630 /* Get the Tamper 1 interrupt source enable status */
632 {
633 /* Get the pending status of the Tamper 1 Interrupt */
635 {
636 /* Clear the Tamper interrupt pending bit */
638
639 /* Tamper callback */
640#if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
641 hrtc->Tamper1EventCallback(hrtc);
642#else
644#endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
645 }
646 }
647
648#if defined(RTC_TAMPER2_SUPPORT)
649 /* Get the Tamper 2 interrupt source enable status */
651 {
652 /* Get the pending status of the Tamper 2 Interrupt */
653 if (__HAL_RTC_TAMPER_GET_FLAG(hrtc, RTC_FLAG_TAMP2F) != 0U)
654 {
655 /* Clear the Tamper interrupt pending bit */
656 __HAL_RTC_TAMPER_CLEAR_FLAG(hrtc, RTC_FLAG_TAMP2F);
657
658 /* Tamper callback */
659#if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
660 hrtc->Tamper2EventCallback(hrtc);
661#else
662 HAL_RTCEx_Tamper2EventCallback(hrtc);
663#endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
664 }
665 }
666#endif /* RTC_TAMPER2_SUPPORT */
667
668 /* Change RTC state */
670}
671
679{
680 /* Prevent unused argument(s) compilation warning */
681 UNUSED(hrtc);
682
683 /* NOTE: This function should not be modified, when the callback is needed,
684 the HAL_RTCEx_TimeStampEventCallback could be implemented in the user file
685 */
686}
687
695{
696 /* Prevent unused argument(s) compilation warning */
697 UNUSED(hrtc);
698
699 /* NOTE: This function should not be modified, when the callback is needed,
700 the HAL_RTCEx_Tamper1EventCallback could be implemented in the user file
701 */
702}
703
704#if defined(RTC_TAMPER2_SUPPORT)
711__weak void HAL_RTCEx_Tamper2EventCallback(RTC_HandleTypeDef *hrtc)
712{
713 /* Prevent unused argument(s) compilation warning */
714 UNUSED(hrtc);
715
716 /* NOTE: This function should not be modified, when the callback is needed,
717 the HAL_RTCEx_Tamper2EventCallback could be implemented in the user file
718 */
719}
720#endif /* RTC_TAMPER2_SUPPORT */
721
730{
731 uint32_t tickstart = 0U;
732
733 /* Get tick */
734 tickstart = HAL_GetTick();
735
736 while (__HAL_RTC_TIMESTAMP_GET_FLAG(hrtc, RTC_FLAG_TSF) == 0U)
737 {
738 if (Timeout != HAL_MAX_DELAY)
739 {
740 if ((Timeout == 0U) || ((HAL_GetTick() - tickstart) > Timeout))
741 {
743 return HAL_TIMEOUT;
744 }
745 }
746
748 {
749 /* Clear the Timestamp Overrun Flag */
751
752 /* Change Timestamp state */
754
755 return HAL_ERROR;
756 }
757 }
758
759 /* Change RTC state */
761
762 return HAL_OK;
763}
764
773{
774 uint32_t tickstart = 0U;
775
776 /* Get tick */
777 tickstart = HAL_GetTick();
778
779 /* Get the status of the Interrupt */
780 while (__HAL_RTC_TAMPER_GET_FLAG(hrtc, RTC_FLAG_TAMP1F) == 0U)
781 {
782 if (Timeout != HAL_MAX_DELAY)
783 {
784 if ((Timeout == 0U) || ((HAL_GetTick() - tickstart) > Timeout))
785 {
787 return HAL_TIMEOUT;
788 }
789 }
790 }
791
792 /* Clear the Tamper Flag */
794
795 /* Change RTC state */
797
798 return HAL_OK;
799}
800
801#if defined(RTC_TAMPER2_SUPPORT)
809HAL_StatusTypeDef HAL_RTCEx_PollForTamper2Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout)
810{
811 uint32_t tickstart = 0U;
812
813 /* Get tick */
814 tickstart = HAL_GetTick();
815
816 /* Get the status of the Interrupt */
817 while (__HAL_RTC_TAMPER_GET_FLAG(hrtc, RTC_FLAG_TAMP2F) == 0U)
818 {
819 if (Timeout != HAL_MAX_DELAY)
820 {
821 if ((Timeout == 0U) || ((HAL_GetTick() - tickstart) > Timeout))
822 {
824 return HAL_TIMEOUT;
825 }
826 }
827 }
828
829 /* Clear the Tamper Flag */
830 __HAL_RTC_TAMPER_CLEAR_FLAG(hrtc, RTC_FLAG_TAMP2F);
831
832 /* Change RTC state */
834
835 return HAL_OK;
836}
837#endif /* RTC_TAMPER2_SUPPORT */
838
865HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock)
866{
867 uint32_t tickstart = 0U;
868
869 /* Check the parameters */
870 assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock));
871 assert_param(IS_RTC_WAKEUP_COUNTER(WakeUpCounter));
872
873 /* Process Locked */
874 __HAL_LOCK(hrtc);
875
877
878 /* Disable the write protection for RTC registers */
880
881 /* Check RTC WUTWF flag is reset only when wakeup timer enabled*/
882 if ((hrtc->Instance->CR & RTC_CR_WUTE) != 0U)
883 {
884 tickstart = HAL_GetTick();
885
886 /* Wait till RTC WUTWF flag is reset and if timeout is reached exit */
888 {
889 if ((HAL_GetTick() - tickstart) > RTC_TIMEOUT_VALUE)
890 {
891 /* Enable the write protection for RTC registers */
893
895
896 /* Process Unlocked */
897 __HAL_UNLOCK(hrtc);
898
899 return HAL_TIMEOUT;
900 }
901 }
902 }
903
904 /* Disable the Wakeup timer */
906
907 /* Clear the Wakeup flag */
909
910 /* Get tick */
911 tickstart = HAL_GetTick();
912
913 /* Wait till RTC WUTWF flag is set and if timeout is reached exit */
915 {
916 if ((HAL_GetTick() - tickstart) > RTC_TIMEOUT_VALUE)
917 {
918 /* Enable the write protection for RTC registers */
920
922
923 /* Process Unlocked */
924 __HAL_UNLOCK(hrtc);
925
926 return HAL_TIMEOUT;
927 }
928 }
929
930 /* Clear the Wakeup Timer clock source bits in CR register */
931 hrtc->Instance->CR &= (uint32_t)~RTC_CR_WUCKSEL;
932
933 /* Configure the clock source */
934 hrtc->Instance->CR |= (uint32_t)WakeUpClock;
935
936 /* Configure the Wakeup Timer counter */
937 hrtc->Instance->WUTR = (uint32_t)WakeUpCounter;
938
939 /* Enable the Wakeup Timer */
941
942 /* Enable the write protection for RTC registers */
944
946
947 /* Process Unlocked */
948 __HAL_UNLOCK(hrtc);
949
950 return HAL_OK;
951}
952
961HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock)
962{
963 __IO uint32_t count = RTC_TIMEOUT_VALUE * (SystemCoreClock / 32U / 1000U);
964
965 /* Check the parameters */
966 assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock));
967 assert_param(IS_RTC_WAKEUP_COUNTER(WakeUpCounter));
968
969 /* Process Locked */
970 __HAL_LOCK(hrtc);
971
973
974 /* Disable the write protection for RTC registers */
976
977 /* Check RTC WUTWF flag is reset only when wakeup timer enabled */
978 if ((hrtc->Instance->CR & RTC_CR_WUTE) != 0U)
979 {
980 /* Wait till RTC WUTWF flag is reset and if timeout is reached exit */
981 do
982 {
983 count = count - 1U;
984 if (count == 0U)
985 {
986 /* Enable the write protection for RTC registers */
988
990
991 /* Process Unlocked */
992 __HAL_UNLOCK(hrtc);
993
994 return HAL_TIMEOUT;
995 }
996 } while (__HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTWF) != 0U);
997 }
998
999 /* Disable the Wakeup timer */
1001
1002 /* Clear the Wakeup flag */
1004
1005 /* Reload the counter */
1006 count = RTC_TIMEOUT_VALUE * (SystemCoreClock / 32U / 1000U);
1007
1008 /* Wait till RTC WUTWF flag is set and if timeout is reached exit */
1009 do
1010 {
1011 count = count - 1U;
1012 if (count == 0U)
1013 {
1014 /* Enable the write protection for RTC registers */
1016
1018
1019 /* Process Unlocked */
1020 __HAL_UNLOCK(hrtc);
1021
1022 return HAL_TIMEOUT;
1023 }
1024 } while (__HAL_RTC_WAKEUPTIMER_GET_FLAG(hrtc, RTC_FLAG_WUTWF) == 0U);
1025
1026 /* Clear the Wakeup Timer clock source bits in CR register */
1027 hrtc->Instance->CR &= (uint32_t)~RTC_CR_WUCKSEL;
1028
1029 /* Configure the clock source */
1030 hrtc->Instance->CR |= (uint32_t)WakeUpClock;
1031
1032 /* Configure the Wakeup Timer counter */
1033 hrtc->Instance->WUTR = (uint32_t)WakeUpCounter;
1034
1035 /* RTC wakeup timer Interrupt Configuration: EXTI configuration */
1038
1039 /* Configure the interrupt in the RTC_CR register */
1041
1042 /* Enable the Wakeup Timer */
1044
1045 /* Enable the write protection for RTC registers */
1047
1048 hrtc->State = HAL_RTC_STATE_READY;
1049
1050 /* Process Unlocked */
1051 __HAL_UNLOCK(hrtc);
1052
1053 return HAL_OK;
1054}
1055
1063{
1064 uint32_t tickstart = 0U;
1065
1066 /* Process Locked */
1067 __HAL_LOCK(hrtc);
1068
1069 hrtc->State = HAL_RTC_STATE_BUSY;
1070
1071 /* Disable the write protection for RTC registers */
1073
1074 /* Disable the Wakeup Timer */
1076
1077 /* In case of interrupt mode is used, the interrupt source must disabled */
1079
1080 /* Get tick */
1081 tickstart = HAL_GetTick();
1082
1083 /* Wait till RTC WUTWF flag is set and if timeout is reached exit */
1085 {
1086 if ((HAL_GetTick() - tickstart) > RTC_TIMEOUT_VALUE)
1087 {
1088 /* Enable the write protection for RTC registers */
1090
1092
1093 /* Process Unlocked */
1094 __HAL_UNLOCK(hrtc);
1095
1096 return HAL_TIMEOUT;
1097 }
1098 }
1099
1100 /* Enable the write protection for RTC registers */
1102
1103 hrtc->State = HAL_RTC_STATE_READY;
1104
1105 /* Process Unlocked */
1106 __HAL_UNLOCK(hrtc);
1107
1108 return HAL_OK;
1109}
1110
1118{
1119 /* Get the counter value */
1120 return ((uint32_t)(hrtc->Instance->WUTR & RTC_WUTR_WUT));
1121}
1122
1135{
1136 /* Clear the EXTI's line Flag for RTC WakeUpTimer */
1138
1139 /* Get the pending status of the Wakeup timer Interrupt */
1141 {
1142 /* Clear the Wakeup timer interrupt pending bit */
1144
1145 /* Wakeup timer callback */
1146#if (USE_HAL_RTC_REGISTER_CALLBACKS == 1)
1147 hrtc->WakeUpTimerEventCallback(hrtc);
1148#else
1150#endif /* USE_HAL_RTC_REGISTER_CALLBACKS */
1151 }
1152
1153 /* Change RTC state */
1154 hrtc->State = HAL_RTC_STATE_READY;
1155}
1156
1164{
1165 /* Prevent unused argument(s) compilation warning */
1166 UNUSED(hrtc);
1167
1168 /* NOTE: This function should not be modified, when the callback is needed,
1169 the HAL_RTCEx_WakeUpTimerEventCallback could be implemented in the user file
1170 */
1171}
1172
1181{
1182 uint32_t tickstart = 0U;
1183
1184 /* Get tick */
1185 tickstart = HAL_GetTick();
1186
1188 {
1189 if (Timeout != HAL_MAX_DELAY)
1190 {
1191 if ((Timeout == 0U) || ((HAL_GetTick() - tickstart) > Timeout))
1192 {
1194 return HAL_TIMEOUT;
1195 }
1196 }
1197 }
1198
1199 /* Clear the Wakeup timer Flag */
1201
1202 /* Change RTC state */
1203 hrtc->State = HAL_RTC_STATE_READY;
1204
1205 return HAL_OK;
1206}
1207
1248void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data)
1249{
1250 uint32_t tmp = 0U;
1251
1252 /* Check the parameters */
1253 assert_param(IS_RTC_BKP(BackupRegister));
1254
1255 tmp = (uint32_t) & (hrtc->Instance->BKP0R);
1256 tmp += (BackupRegister * 4U);
1257
1258 /* Write the specified register */
1259 *(__IO uint32_t *)tmp = (uint32_t)Data;
1260}
1261
1271uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister)
1272{
1273 uint32_t tmp = 0U;
1274
1275 /* Check the parameters */
1276 assert_param(IS_RTC_BKP(BackupRegister));
1277
1278 tmp = (uint32_t) & (hrtc->Instance->BKP0R);
1279 tmp += (BackupRegister * 4U);
1280
1281 /* Read the specified register */
1282 return (*(__IO uint32_t *)tmp);
1283}
1284
1302HAL_StatusTypeDef HAL_RTCEx_SetCoarseCalib(RTC_HandleTypeDef *hrtc, uint32_t CalibSign, uint32_t Value)
1303{
1304 HAL_StatusTypeDef status;
1305
1306 /* Check the parameters */
1307 assert_param(IS_RTC_CALIB_SIGN(CalibSign));
1309
1310 /* Process Locked */
1311 __HAL_LOCK(hrtc);
1312
1313 hrtc->State = HAL_RTC_STATE_BUSY;
1314
1315 /* Disable the write protection for RTC registers */
1317
1318 /* Enter Initialization mode */
1319 status = RTC_EnterInitMode(hrtc);
1320
1321 if (status == HAL_OK)
1322 {
1323 /* Enable the Coarse Calibration */
1325
1326 /* Set the coarse calibration value */
1327 hrtc->Instance->CALIBR = (uint32_t)(CalibSign | Value);
1328
1329 /* Exit Initialization mode */
1330 status = RTC_ExitInitMode(hrtc);
1331 }
1332
1333 if (status == HAL_OK)
1334 {
1335 hrtc->State = HAL_RTC_STATE_READY;
1336 }
1337
1338 /* Enable the write protection for RTC registers */
1340
1341 /* Process Unlocked */
1342 __HAL_UNLOCK(hrtc);
1343
1344 return status;
1345}
1346
1354{
1355 HAL_StatusTypeDef status;
1356
1357 /* Process Locked */
1358 __HAL_LOCK(hrtc);
1359
1360 hrtc->State = HAL_RTC_STATE_BUSY;
1361
1362 /* Disable the write protection for RTC registers */
1364
1365 /* Enter Initialization mode */
1366 status = RTC_EnterInitMode(hrtc);
1367
1368 if (status == HAL_OK)
1369 {
1370 /* Disable the Coarse Calibration */
1372
1373 /* Exit Initialization mode */
1374 status = RTC_ExitInitMode(hrtc);
1375 }
1376
1377 if (status == HAL_OK)
1378 {
1379 hrtc->State = HAL_RTC_STATE_READY;
1380 }
1381
1382 /* Enable the write protection for RTC registers */
1384
1385 /* Process Unlocked */
1386 __HAL_UNLOCK(hrtc);
1387
1388 return status;
1389}
1390
1411HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmoothCalibMinusPulsesValue)
1412{
1413 uint32_t tickstart = 0U;
1414
1415 /* Check the parameters */
1416 assert_param(IS_RTC_SMOOTH_CALIB_PERIOD(SmoothCalibPeriod));
1417 assert_param(IS_RTC_SMOOTH_CALIB_PLUS(SmoothCalibPlusPulses));
1418 assert_param(IS_RTC_SMOOTH_CALIB_MINUS(SmoothCalibMinusPulsesValue));
1419
1420 /* Process Locked */
1421 __HAL_LOCK(hrtc);
1422
1423 hrtc->State = HAL_RTC_STATE_BUSY;
1424
1425 /* Disable the write protection for RTC registers */
1427
1428 /* check if a calibration is pending*/
1429 if ((hrtc->Instance->ISR & RTC_ISR_RECALPF) != 0U)
1430 {
1431 /* Get tick */
1432 tickstart = HAL_GetTick();
1433
1434 /* check if a calibration is pending*/
1435 while ((hrtc->Instance->ISR & RTC_ISR_RECALPF) != 0U)
1436 {
1437 if ((HAL_GetTick() - tickstart) > RTC_TIMEOUT_VALUE)
1438 {
1439 /* Enable the write protection for RTC registers */
1441
1442 /* Change RTC state */
1444
1445 /* Process Unlocked */
1446 __HAL_UNLOCK(hrtc);
1447
1448 return HAL_TIMEOUT;
1449 }
1450 }
1451 }
1452
1453 /* Configure the Smooth calibration settings */
1454 hrtc->Instance->CALR = (uint32_t)((uint32_t)SmoothCalibPeriod | \
1455 (uint32_t)SmoothCalibPlusPulses | \
1456 (uint32_t)SmoothCalibMinusPulsesValue);
1457
1458 /* Enable the write protection for RTC registers */
1460
1461 /* Change RTC state */
1462 hrtc->State = HAL_RTC_STATE_READY;
1463
1464 /* Process Unlocked */
1465 __HAL_UNLOCK(hrtc);
1466
1467 return HAL_OK;
1468}
1469
1483HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS)
1484{
1485 uint32_t tickstart = 0U;
1486
1487 /* Check the parameters */
1488 assert_param(IS_RTC_SHIFT_ADD1S(ShiftAdd1S));
1489 assert_param(IS_RTC_SHIFT_SUBFS(ShiftSubFS));
1490
1491 /* Process Locked */
1492 __HAL_LOCK(hrtc);
1493
1494 hrtc->State = HAL_RTC_STATE_BUSY;
1495
1496 /* Disable the write protection for RTC registers */
1498
1499 /* Get tick */
1500 tickstart = HAL_GetTick();
1501
1502 /* Wait until the shift is completed */
1503 while ((hrtc->Instance->ISR & RTC_ISR_SHPF) != 0U)
1504 {
1505 if ((HAL_GetTick() - tickstart) > RTC_TIMEOUT_VALUE)
1506 {
1507 /* Enable the write protection for RTC registers */
1509
1511
1512 /* Process Unlocked */
1513 __HAL_UNLOCK(hrtc);
1514
1515 return HAL_TIMEOUT;
1516 }
1517 }
1518
1519 /* Check if the reference clock detection is disabled */
1520 if ((hrtc->Instance->CR & RTC_CR_REFCKON) == 0U)
1521 {
1522 /* Configure the Shift settings */
1523 hrtc->Instance->SHIFTR = (uint32_t)(uint32_t)(ShiftSubFS) | (uint32_t)(ShiftAdd1S);
1524
1525 /* If RTC_CR_BYPSHAD bit = 0, wait for synchro else this check is not needed */
1526 if ((hrtc->Instance->CR & RTC_CR_BYPSHAD) == 0U)
1527 {
1528 if (HAL_RTC_WaitForSynchro(hrtc) != HAL_OK)
1529 {
1530 /* Enable the write protection for RTC registers */
1532
1533 hrtc->State = HAL_RTC_STATE_ERROR;
1534
1535 /* Process Unlocked */
1536 __HAL_UNLOCK(hrtc);
1537
1538 return HAL_ERROR;
1539 }
1540 }
1541 }
1542 else
1543 {
1544 /* Enable the write protection for RTC registers */
1546
1547 /* Change RTC state */
1548 hrtc->State = HAL_RTC_STATE_ERROR;
1549
1550 /* Process Unlocked */
1551 __HAL_UNLOCK(hrtc);
1552
1553 return HAL_ERROR;
1554 }
1555
1556 /* Enable the write protection for RTC registers */
1558
1559 /* Change RTC state */
1560 hrtc->State = HAL_RTC_STATE_READY;
1561
1562 /* Process Unlocked */
1563 __HAL_UNLOCK(hrtc);
1564
1565 return HAL_OK;
1566}
1567
1579{
1580 /* Check the parameters */
1581 assert_param(IS_RTC_CALIB_OUTPUT(CalibOutput));
1582
1583 /* Process Locked */
1584 __HAL_LOCK(hrtc);
1585
1586 hrtc->State = HAL_RTC_STATE_BUSY;
1587
1588 /* Disable the write protection for RTC registers */
1590
1591 /* Clear flags before config */
1592 hrtc->Instance->CR &= (uint32_t)~RTC_CR_COSEL;
1593
1594 /* Configure the RTC_CR register */
1595 hrtc->Instance->CR |= (uint32_t)CalibOutput;
1596
1598
1599 /* Enable the write protection for RTC registers */
1601
1602 /* Change RTC state */
1603 hrtc->State = HAL_RTC_STATE_READY;
1604
1605 /* Process Unlocked */
1606 __HAL_UNLOCK(hrtc);
1607
1608 return HAL_OK;
1609}
1610
1618{
1619 /* Process Locked */
1620 __HAL_LOCK(hrtc);
1621
1622 hrtc->State = HAL_RTC_STATE_BUSY;
1623
1624 /* Disable the write protection for RTC registers */
1626
1628
1629 /* Enable the write protection for RTC registers */
1631
1632 /* Change RTC state */
1633 hrtc->State = HAL_RTC_STATE_READY;
1634
1635 /* Process Unlocked */
1636 __HAL_UNLOCK(hrtc);
1637
1638 return HAL_OK;
1639}
1640
1648{
1649 HAL_StatusTypeDef status;
1650
1651 /* Process Locked */
1652 __HAL_LOCK(hrtc);
1653
1654 hrtc->State = HAL_RTC_STATE_BUSY;
1655
1656 /* Disable the write protection for RTC registers */
1658
1659 /* Enter Initialization mode */
1660 status = RTC_EnterInitMode(hrtc);
1661
1662 if (status == HAL_OK)
1663 {
1664 /* Enable the reference clock detection */
1666
1667 /* Exit Initialization mode */
1668 status = RTC_ExitInitMode(hrtc);
1669 }
1670
1671 if (status == HAL_OK)
1672 {
1673 hrtc->State = HAL_RTC_STATE_READY;
1674 }
1675
1676 /* Enable the write protection for RTC registers */
1678
1679 /* Process Unlocked */
1680 __HAL_UNLOCK(hrtc);
1681
1682 return status;
1683}
1684
1692{
1693 HAL_StatusTypeDef status;
1694
1695 /* Process Locked */
1696 __HAL_LOCK(hrtc);
1697
1698 hrtc->State = HAL_RTC_STATE_BUSY;
1699
1700 /* Disable the write protection for RTC registers */
1702
1703 /* Enter Initialization mode */
1704 status = RTC_EnterInitMode(hrtc);
1705
1706 if (status == HAL_OK)
1707 {
1708 /* Disable the reference clock detection */
1710
1711 /* Exit Initialization mode */
1712 status = RTC_ExitInitMode(hrtc);
1713 }
1714
1715 if (status == HAL_OK)
1716 {
1717 hrtc->State = HAL_RTC_STATE_READY;
1718 }
1719
1720 /* Enable the write protection for RTC registers */
1722
1723 /* Process Unlocked */
1724 __HAL_UNLOCK(hrtc);
1725
1726 return status;
1727}
1728
1738{
1739 /* Process Locked */
1740 __HAL_LOCK(hrtc);
1741
1742 hrtc->State = HAL_RTC_STATE_BUSY;
1743
1744 /* Disable the write protection for RTC registers */
1746
1747 /* Set the BYPSHAD bit */
1748 hrtc->Instance->CR |= (uint8_t)RTC_CR_BYPSHAD;
1749
1750 /* Enable the write protection for RTC registers */
1752
1753 /* Change RTC state */
1754 hrtc->State = HAL_RTC_STATE_READY;
1755
1756 /* Process Unlocked */
1757 __HAL_UNLOCK(hrtc);
1758
1759 return HAL_OK;
1760}
1761
1771{
1772 /* Process Locked */
1773 __HAL_LOCK(hrtc);
1774
1775 hrtc->State = HAL_RTC_STATE_BUSY;
1776
1777 /* Disable the write protection for RTC registers */
1779
1780 /* Reset the BYPSHAD bit */
1781 hrtc->Instance->CR &= (uint8_t)~RTC_CR_BYPSHAD;
1782
1783 /* Enable the write protection for RTC registers */
1785
1786 /* Change RTC state */
1787 hrtc->State = HAL_RTC_STATE_READY;
1788
1789 /* Process Unlocked */
1790 __HAL_UNLOCK(hrtc);
1791
1792 return HAL_OK;
1793}
1794
1821{
1822 /* Prevent unused argument(s) compilation warning */
1823 UNUSED(hrtc);
1824
1825 /* NOTE: This function should not be modified, when the callback is needed,
1826 the HAL_RTCEx_AlarmBEventCallback could be implemented in the user file
1827 */
1828}
1829
1838{
1839 uint32_t tickstart = 0U;
1840
1841 /* Get tick */
1842 tickstart = HAL_GetTick();
1843
1844 /* Wait till RTC ALRBF flag is set and if timeout is reached exit */
1845 while (__HAL_RTC_ALARM_GET_FLAG(hrtc, RTC_FLAG_ALRBF) == 0U)
1846 {
1847 if (Timeout != HAL_MAX_DELAY)
1848 {
1849 if ((Timeout == 0U) || ((HAL_GetTick() - tickstart) > Timeout))
1850 {
1852 return HAL_TIMEOUT;
1853 }
1854 }
1855 }
1856
1857 /* Clear the Alarm flag */
1859
1860 /* Change RTC state */
1861 hrtc->State = HAL_RTC_STATE_READY;
1862
1863 return HAL_OK;
1864}
1865
1874#endif /* HAL_RTC_MODULE_ENABLED */
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
#define __HAL_RTC_CALIBRATION_OUTPUT_ENABLE(__HANDLE__)
Enable the RTC calibration output.
#define __HAL_RTC_CLOCKREF_DETECTION_ENABLE(__HANDLE__)
Enable the clock reference detection.
#define __HAL_RTC_CLOCKREF_DETECTION_DISABLE(__HANDLE__)
Disable the clock reference detection.
#define __HAL_RTC_COARSE_CALIB_DISABLE(__HANDLE__)
Disable the Coarse calibration process.
#define __HAL_RTC_COARSE_CALIB_ENABLE(__HANDLE__)
Enable the Coarse calibration process.
#define __HAL_RTC_CALIBRATION_OUTPUT_DISABLE(__HANDLE__)
Disable the calibration output.
void HAL_RTCEx_TimeStampEventCallback(RTC_HandleTypeDef *hrtc)
Timestamp callback.
HAL_StatusTypeDef HAL_RTCEx_DeactivateTimeStamp(RTC_HandleTypeDef *hrtc)
Deactivates Timestamp.
void HAL_RTCEx_Tamper1EventCallback(RTC_HandleTypeDef *hrtc)
Tamper 1 callback.
HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef *sTamper)
Sets Tamper with interrupt.
HAL_StatusTypeDef HAL_RTCEx_SetTamper(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef *sTamper)
Sets Tamper.
HAL_StatusTypeDef HAL_RTCEx_GetTimeStamp(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTimeStamp, RTC_DateTypeDef *sTimeStampDate, uint32_t Format)
Gets the RTC Timestamp value.
void HAL_RTCEx_TamperTimeStampIRQHandler(RTC_HandleTypeDef *hrtc)
Handles Timestamp and Tamper interrupt request.
HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp(RTC_HandleTypeDef *hrtc, uint32_t RTC_TimeStampEdge, uint32_t RTC_TimeStampPin)
Sets Timestamp.
HAL_StatusTypeDef HAL_RTCEx_SetTimeStamp_IT(RTC_HandleTypeDef *hrtc, uint32_t RTC_TimeStampEdge, uint32_t RTC_TimeStampPin)
Sets Timestamp with Interrupt.
HAL_StatusTypeDef HAL_RTCEx_PollForTamper1Event(RTC_HandleTypeDef *hrtc, uint32_t Timeout)
Handles Tamper 1 Polling.
HAL_StatusTypeDef HAL_RTCEx_DeactivateTamper(RTC_HandleTypeDef *hrtc, uint32_t Tamper)
Deactivates Tamper.
HAL_StatusTypeDef HAL_RTCEx_PollForTimeStampEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout)
Handles Timestamp polling request.
HAL_StatusTypeDef HAL_RTCEx_PollForWakeUpTimerEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout)
Handles Wakeup Timer Polling.
HAL_StatusTypeDef HAL_RTCEx_DeactivateWakeUpTimer(RTC_HandleTypeDef *hrtc)
Deactivates wakeup timer counter.
void HAL_RTCEx_WakeUpTimerIRQHandler(RTC_HandleTypeDef *hrtc)
Handles Wakeup Timer interrupt request.
HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer_IT(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock)
Sets wakeup timer with interrupt.
void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc)
Wakeup Timer callback.
HAL_StatusTypeDef HAL_RTCEx_SetWakeUpTimer(RTC_HandleTypeDef *hrtc, uint32_t WakeUpCounter, uint32_t WakeUpClock)
Sets wakeup timer.
uint32_t HAL_RTCEx_GetWakeUpTimer(RTC_HandleTypeDef *hrtc)
Gets wakeup timer counter.
HAL_StatusTypeDef HAL_RTCEx_SetSynchroShift(RTC_HandleTypeDef *hrtc, uint32_t ShiftAdd1S, uint32_t ShiftSubFS)
Configures the Synchronization Shift Control Settings.
HAL_StatusTypeDef HAL_RTCEx_SetCoarseCalib(RTC_HandleTypeDef *hrtc, uint32_t CalibSign, uint32_t Value)
Sets the Coarse calibration parameters.
uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister)
Reads data from the specified RTC Backup data Register.
HAL_StatusTypeDef HAL_RTCEx_SetSmoothCalib(RTC_HandleTypeDef *hrtc, uint32_t SmoothCalibPeriod, uint32_t SmoothCalibPlusPulses, uint32_t SmoothCalibMinusPulsesValue)
Sets the Smooth calibration parameters.
HAL_StatusTypeDef HAL_RTCEx_DeactivateCalibrationOutPut(RTC_HandleTypeDef *hrtc)
Deactivates the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz).
HAL_StatusTypeDef HAL_RTCEx_EnableBypassShadow(RTC_HandleTypeDef *hrtc)
Enables the Bypass Shadow feature.
HAL_StatusTypeDef HAL_RTCEx_DeactivateCoarseCalib(RTC_HandleTypeDef *hrtc)
Deactivates the Coarse calibration parameters.
HAL_StatusTypeDef HAL_RTCEx_DeactivateRefClock(RTC_HandleTypeDef *hrtc)
Disable the RTC reference clock detection.
HAL_StatusTypeDef HAL_RTCEx_DisableBypassShadow(RTC_HandleTypeDef *hrtc)
Disables the Bypass Shadow feature.
HAL_StatusTypeDef HAL_RTCEx_SetRefClock(RTC_HandleTypeDef *hrtc)
Enables the RTC reference clock detection.
void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data)
Writes a data in a specified RTC Backup data register.
HAL_StatusTypeDef HAL_RTCEx_SetCalibrationOutPut(RTC_HandleTypeDef *hrtc, uint32_t CalibOutput)
Configures the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz).
void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *hrtc)
Alarm B callback.
HAL_StatusTypeDef HAL_RTCEx_PollForAlarmBEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout)
Handles Alarm B Polling request.
#define IS_RTC_SMOOTH_CALIB_MINUS(VALUE)
#define IS_RTC_SHIFT_ADD1S(SEL)
#define IS_RTC_TAMPER_TRIGGER(TRIGGER)
#define IS_TIMESTAMP_EDGE(EDGE)
#define IS_RTC_TIMESTAMP_PIN(PIN)
#define IS_RTC_WAKEUP_COUNTER(COUNTER)
#define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD)
#define IS_RTC_BKP(BKP)
#define IS_RTC_SHIFT_SUBFS(FS)
#define IS_RTC_TAMPER(TAMPER)
#define IS_RTC_CALIB_SIGN(SIGN)
#define IS_RTC_TAMPER_FILTER(FILTER)
#define IS_RTC_TAMPER_PULLUP_STATE(STATE)
#define IS_RTC_WAKEUP_CLOCK(CLOCK)
#define IS_RTC_SMOOTH_CALIB_PLUS(PLUS)
#define IS_RTC_TAMPER_FILTER_CONFIG_CORRECT(FILTER, TRIGGER)
#define IS_RTC_TAMPER_TIMESTAMPONTAMPER_DETECTION(DETECTION)
#define IS_RTC_CALIB_OUTPUT(OUTPUT)
#define IS_RTC_TAMPER_SAMPLING_FREQ(FREQ)
#define IS_RTC_CALIB_VALUE(VALUE)
#define IS_RTC_TAMPER_PRECHARGE_DURATION(DURATION)
#define IS_RTC_TAMPER_PIN(PIN)
#define RTC_TAMPERFILTER_MASK
#define RTC_IT_TAMP
#define RTC_TAMPERPRECHARGEDURATION_MASK
#define RTC_TAMPER_PULLUP_MASK
#define RTC_TAMPERSAMPLINGFREQ_RTCCLK_MASK
#define RTC_TIMESTAMPONTAMPERDETECTION_MASK
#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE()
Enable rising edge trigger on the RTC Tamper and Timestamp associated EXTI line.
#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_IT()
Enable interrupt on the RTC Tamper and Timestamp associated EXTI line.
#define __HAL_RTC_TAMPER_TIMESTAMP_EXTI_CLEAR_FLAG()
Clear the RTC Tamper and Timestamp associated EXTI line flag.
#define RTC_TAMPERTRIGGER_FALLINGEDGE
#define __HAL_RTC_TAMPER_CLEAR_FLAG(__HANDLE__, __FLAG__)
Clear the RTC Tamper's pending flags.
#define __HAL_RTC_TAMPER_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)
Check whether the specified RTC Tamper interrupt has been enabled or not.
#define __HAL_RTC_TAMPER_GET_FLAG(__HANDLE__, __FLAG__)
Get the selected RTC Tamper's flag status.
#define __HAL_RTC_TIMESTAMP_ENABLE_IT(__HANDLE__, __INTERRUPT__)
Enable the RTC Timestamp interrupt.
#define __HAL_RTC_TIMESTAMP_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)
Check whether the specified RTC Timestamp interrupt has been enabled or not.
#define __HAL_RTC_TIMESTAMP_GET_FLAG(__HANDLE__, __FLAG__)
Get the selected RTC Timestamp's flag status.
#define __HAL_RTC_TIMESTAMP_DISABLE_IT(__HANDLE__, __INTERRUPT__)
Disable the RTC Timestamp interrupt.
#define __HAL_RTC_TIMESTAMP_CLEAR_FLAG(__HANDLE__, __FLAG__)
Clear the RTC Timestamp's pending flags.
#define __HAL_RTC_TIMESTAMP_ENABLE(__HANDLE__)
Enable the RTC Timestamp peripheral.
#define __HAL_RTC_WAKEUPTIMER_DISABLE(__HANDLE__)
Disable the RTC Wakeup Timer peripheral.
#define __HAL_RTC_WAKEUPTIMER_GET_FLAG(__HANDLE__, __FLAG__)
Get the selected RTC Wakeup Timer's flag status.
#define __HAL_RTC_WAKEUPTIMER_EXTI_CLEAR_FLAG()
Clear the RTC Wakeup Timer associated EXTI line flag.
#define __HAL_RTC_WAKEUPTIMER_DISABLE_IT(__HANDLE__, __INTERRUPT__)
Disable the RTC Wakeup Timer interrupt.
#define __HAL_RTC_WAKEUPTIMER_ENABLE(__HANDLE__)
Enable the RTC WakeUp Timer peripheral.
#define __HAL_RTC_WAKEUPTIMER_ENABLE_IT(__HANDLE__, __INTERRUPT__)
Enable the RTC Wakeup Timer interrupt.
#define __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(__HANDLE__, __FLAG__)
Clear the RTC Wakeup timer's pending flags.
#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE()
Enable rising edge trigger on the RTC Wakeup Timer associated EXTI line.
#define __HAL_RTC_WAKEUPTIMER_EXTI_ENABLE_IT()
Enable interrupt on the RTC Wakeup Timer associated EXTI line.
HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef *hrtc)
Waits until the RTC Time and Date registers (RTC_TR and RTC_DR) are synchronized with RTC APB clock.
#define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__)
Clear the RTC Alarm's pending flags.
#define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__)
Enable the write protection for RTC registers.
#define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__)
Get the selected RTC Alarm's flag status.
#define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__)
Disable the write protection for RTC registers.
@ HAL_RTC_STATE_TIMEOUT
@ HAL_RTC_STATE_ERROR
@ HAL_RTC_STATE_READY
@ HAL_RTC_STATE_BUSY
#define RTC_FLAG_WUTWF
#define RTC_FLAG_TAMP1F
#define RTC_FLAG_TSOVF
#define RTC_FLAG_TSF
#define RTC_FLAG_ALRBF
#define RTC_FLAG_WUTF
#define IS_RTC_FORMAT(FORMAT)
#define RTC_FORMAT_BIN
#define RTC_IT_TS
#define RTC_IT_WUT
#define RTC_DR_RESERVED_MASK
#define RTC_TIMEOUT_VALUE
#define RTC_TR_RESERVED_MASK
HAL_StatusTypeDef RTC_ExitInitMode(RTC_HandleTypeDef *hrtc)
Exits the RTC Initialization mode.
HAL_StatusTypeDef RTC_EnterInitMode(RTC_HandleTypeDef *hrtc)
Enters the RTC Initialization mode.
uint8_t RTC_Bcd2ToByte(uint8_t number)
Converts a 2-digit number from BCD to decimal format.
#define assert_param(expr)
This file contains all the functions prototypes for the HAL module driver.
HAL_StatusTypeDef
HAL Status structures definition
@ HAL_TIMEOUT
@ HAL_ERROR
@ HAL_OK
#define UNUSED(X)
#define __HAL_UNLOCK(__HANDLE__)
#define HAL_MAX_DELAY
#define __HAL_LOCK(__HANDLE__)
RTC Date structure definition.
RTC Handle Structure definition.
__IO HAL_RTCStateTypeDef State
RTC Tamper structure definition.
RTC Time structure definition.