stm32/rtc: Add RTC support for H7 MCUs.
This commit is contained in:
parent
0e51e4d139
commit
711f817c2a
@ -223,12 +223,16 @@ STATIC HAL_StatusTypeDef PYB_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruc
|
||||
|
||||
/*------------------------------ LSE Configuration -------------------------*/
|
||||
if ((RCC_OscInitStruct->OscillatorType & RCC_OSCILLATORTYPE_LSE) == RCC_OSCILLATORTYPE_LSE) {
|
||||
#if !defined(STM32H7)
|
||||
// Enable Power Clock
|
||||
__HAL_RCC_PWR_CLK_ENABLE();
|
||||
#endif
|
||||
|
||||
// Enable access to the backup domain
|
||||
HAL_PWR_EnableBkUpAccess();
|
||||
uint32_t tickstart = HAL_GetTick();
|
||||
|
||||
#if defined(MCU_SERIES_F7) || defined(MCU_SERIES_L4)
|
||||
#if defined(MCU_SERIES_F7) || defined(MCU_SERIES_L4) || defined(STM32H7)
|
||||
//__HAL_RCC_PWR_CLK_ENABLE();
|
||||
// Enable write access to Backup domain
|
||||
//PWR->CR1 |= PWR_CR1_DBP;
|
||||
@ -298,7 +302,7 @@ STATIC HAL_StatusTypeDef PYB_RTC_Init(RTC_HandleTypeDef *hrtc) {
|
||||
// Exit Initialization mode
|
||||
hrtc->Instance->ISR &= (uint32_t)~RTC_ISR_INIT;
|
||||
|
||||
#if defined(MCU_SERIES_L4)
|
||||
#if defined(MCU_SERIES_L4) || defined(STM32H7)
|
||||
hrtc->Instance->OR &= (uint32_t)~RTC_OR_ALARMOUTTYPE;
|
||||
hrtc->Instance->OR |= (uint32_t)(hrtc->Init.OutPutType);
|
||||
#elif defined(MCU_SERIES_F7)
|
||||
@ -634,6 +638,9 @@ mp_obj_t pyb_rtc_wakeup(size_t n_args, const mp_obj_t *args) {
|
||||
#if defined(MCU_SERIES_L4)
|
||||
EXTI->IMR1 |= 1 << 22;
|
||||
EXTI->RTSR1 |= 1 << 22;
|
||||
#elif defined(STM32H7)
|
||||
EXTI_D1->IMR1 |= 1 << 22;
|
||||
EXTI->RTSR1 |= 1 << 22;
|
||||
#else
|
||||
EXTI->IMR |= 1 << 22;
|
||||
EXTI->RTSR |= 1 << 22;
|
||||
@ -643,6 +650,8 @@ mp_obj_t pyb_rtc_wakeup(size_t n_args, const mp_obj_t *args) {
|
||||
RTC->ISR &= ~(1 << 10);
|
||||
#if defined(MCU_SERIES_L4)
|
||||
EXTI->PR1 = 1 << 22;
|
||||
#elif defined(STM32H7)
|
||||
EXTI_D1->PR1 = 1 << 22;
|
||||
#else
|
||||
EXTI->PR = 1 << 22;
|
||||
#endif
|
||||
@ -661,6 +670,8 @@ mp_obj_t pyb_rtc_wakeup(size_t n_args, const mp_obj_t *args) {
|
||||
// disable external interrupts on line 22
|
||||
#if defined(MCU_SERIES_L4)
|
||||
EXTI->IMR1 &= ~(1 << 22);
|
||||
#elif defined(STM32H7)
|
||||
EXTI_D1->IMR1 |= 1 << 22;
|
||||
#else
|
||||
EXTI->IMR &= ~(1 << 22);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user