[HAL][RTC] Expand the cast of 'RTC_CR_BYPSHAD' to 32 bits when writing to the CR register in HAL_RTCEx_DisableBypassShadow() to avoid overwriting its upper bits
diff --git a/Src/stm32f4xx_hal_rtc_ex.c b/Src/stm32f4xx_hal_rtc_ex.c index f6aec5e..fdcc5b6 100644 --- a/Src/stm32f4xx_hal_rtc_ex.c +++ b/Src/stm32f4xx_hal_rtc_ex.c
@@ -1745,7 +1745,7 @@ __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); /* Set the BYPSHAD bit */ - hrtc->Instance->CR |= (uint8_t)RTC_CR_BYPSHAD; + hrtc->Instance->CR |= (uint32_t)RTC_CR_BYPSHAD; /* Enable the write protection for RTC registers */ __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc); @@ -1778,7 +1778,7 @@ __HAL_RTC_WRITEPROTECTION_DISABLE(hrtc); /* Reset the BYPSHAD bit */ - hrtc->Instance->CR &= (uint8_t)~RTC_CR_BYPSHAD; + hrtc->Instance->CR &= (uint32_t)~RTC_CR_BYPSHAD; /* Enable the write protection for RTC registers */ __HAL_RTC_WRITEPROTECTION_ENABLE(hrtc);