diff options
Diffstat (limited to 'bsps/arm/stm32h7/hal/stm32h7xx_ll_rtc.c')
-rw-r--r-- | bsps/arm/stm32h7/hal/stm32h7xx_ll_rtc.c | 50 |
1 files changed, 16 insertions, 34 deletions
diff --git a/bsps/arm/stm32h7/hal/stm32h7xx_ll_rtc.c b/bsps/arm/stm32h7/hal/stm32h7xx_ll_rtc.c index 99498f35ae..e2d24e3495 100644 --- a/bsps/arm/stm32h7/hal/stm32h7xx_ll_rtc.c +++ b/bsps/arm/stm32h7/hal/stm32h7xx_ll_rtc.c @@ -6,13 +6,12 @@ ****************************************************************************** * @attention * - * <h2><center>© Copyright (c) 2017 STMicroelectronics. - * All rights reserved.</center></h2> + * Copyright (c) 2017 STMicroelectronics. + * All rights reserved. * - * This software component is licensed by ST under BSD 3-Clause license, - * the "License"; You may not use this file except in compliance with the - * License. You may obtain a copy of the License at: - * opensource.org/licenses/BSD-3-Clause + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */ @@ -87,18 +86,7 @@ #define IS_LL_RTC_DAY(__DAY__) (((__DAY__) >= 1U) && ((__DAY__) <= 31U)) -#define IS_LL_RTC_MONTH(__VALUE__) (((__VALUE__) == LL_RTC_MONTH_JANUARY) \ - || ((__VALUE__) == LL_RTC_MONTH_FEBRUARY) \ - || ((__VALUE__) == LL_RTC_MONTH_MARCH) \ - || ((__VALUE__) == LL_RTC_MONTH_APRIL) \ - || ((__VALUE__) == LL_RTC_MONTH_MAY) \ - || ((__VALUE__) == LL_RTC_MONTH_JUNE) \ - || ((__VALUE__) == LL_RTC_MONTH_JULY) \ - || ((__VALUE__) == LL_RTC_MONTH_AUGUST) \ - || ((__VALUE__) == LL_RTC_MONTH_SEPTEMBER) \ - || ((__VALUE__) == LL_RTC_MONTH_OCTOBER) \ - || ((__VALUE__) == LL_RTC_MONTH_NOVEMBER) \ - || ((__VALUE__) == LL_RTC_MONTH_DECEMBER)) +#define IS_LL_RTC_MONTH(__MONTH__) (((__MONTH__) >= 1U) && ((__MONTH__) <= 12U)) #define IS_LL_RTC_YEAR(__YEAR__) ((__YEAR__) <= 99U) @@ -175,24 +163,19 @@ ErrorStatus LL_RTC_DeInit(RTC_TypeDef *RTCx) LL_RTC_WriteReg(RTCx, ALRMASSR, 0x00000000U); LL_RTC_WriteReg(RTCx, ALRMBSSR, 0x00000000U); -#if defined(RTC_ICSR_ALRAWF) +#if defined(TAMP) /* Reset ICSR register and exit initialization mode */ - LL_RTC_WriteReg(RTCx, ICSR, 0x00000000U); -#endif /* RTC_ICSR_ALRAWF */ -#if defined(RTC_ISR_ALRAWF) + LL_RTC_WriteReg(RTCx, ICSR, 0x00000000U); +#else /* Reset ISR register and exit initialization mode */ - LL_RTC_WriteReg(RTCx, ISR, 0x00000000U); -#endif /* RTC_ISR_ALRAWF */ + LL_RTC_WriteReg(RTCx, ISR, 0x00000000U); -#if defined(RTC_TAMPCR_TAMP1E) /* Reset Tamper and alternate functions configuration register */ LL_RTC_WriteReg(RTCx, TAMPCR, 0x00000000U); -#endif /* RTC_TAMPCR_TAMP1E */ -#if defined(RTC_OR_ALARMOUTTYPE) /* Reset Option register */ - LL_RTC_WriteReg(RTCx, OR, 0x00000000U); -#endif /* RTC_OR_ALARMOUTTYPE */ + LL_RTC_WriteReg(RTCx, OR, 0x00000000U); +#endif /* TAMP */ /* Wait till the RTC RSF flag is set */ status = LL_RTC_WaitForSynchro(RTCx); @@ -201,14 +184,14 @@ ErrorStatus LL_RTC_DeInit(RTC_TypeDef *RTCx) /* Enable the write protection for RTC registers */ LL_RTC_EnableWriteProtection(RTCx); -#if defined (TAMP_CR1_TAMP1E) +#if defined(TAMP) /* DeInitialization of the TAMP */ LL_RTC_WriteReg(TAMP, CR1, 0xFFFF0000U); LL_RTC_WriteReg(TAMP, FLTCR, 0x00000000U); LL_RTC_WriteReg(TAMP, ATCR1, 0x00000000U); LL_RTC_WriteReg(TAMP, IER, 0x00000000U); LL_RTC_WriteReg(TAMP, SCR, 0xFFFFFFFFU); -#endif /* TAMP_CR1_TAMP1E */ +#endif /* TAMP */ return status; } @@ -343,7 +326,7 @@ ErrorStatus LL_RTC_TIME_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_Time } /* Exit Initialization mode */ - LL_RTC_DisableInitMode(RTC); + LL_RTC_DisableInitMode(RTCx); /* If RTC_CR_BYPSHAD bit = 0, wait for synchro else this check is not needed */ if (LL_RTC_IsShadowRegBypassEnabled(RTCx) == 0U) @@ -431,7 +414,7 @@ ErrorStatus LL_RTC_DATE_Init(RTC_TypeDef *RTCx, uint32_t RTC_Format, LL_RTC_Date } /* Exit Initialization mode */ - LL_RTC_DisableInitMode(RTC); + LL_RTC_DisableInitMode(RTCx); /* If RTC_CR_BYPSHAD bit = 0, wait for synchro else this check is not needed */ if (LL_RTC_IsShadowRegBypassEnabled(RTCx) == 0U) @@ -891,4 +874,3 @@ ErrorStatus LL_RTC_WaitForSynchro(RTC_TypeDef *RTCx) #endif /* USE_FULL_LL_DRIVER */ -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |