Skip to content

Index review #452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions cores/arduino/stm32/rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,16 @@ static void RTC_initClock(sourceClock_t source)
#ifndef RCC_RTCCLKSOURCE_HSE_DIVX
#define RCC_RTCCLKSOURCE_HSE_DIVX 0x00000300U
#endif /* RCC_RTCCLKSOURCE_HSE_DIVX */
for (HSEDiv = 2; HSEDiv < 32; HSEDiv++) {
#if defined(STM32H7xx)
#define HSEDIV_MAX 64
#define HSESHIFT 12
#else
#define HSEDIV_MAX 32
#define HSESHIFT 16
#endif
for (HSEDiv = 2; HSEDiv < HSEDIV_MAX; HSEDiv++) {
if ((HSE_VALUE / HSEDiv) <= HSE_RTC_MAX) {
PeriphClkInit.RTCClockSelection = (HSEDiv << 16) | RCC_RTCCLKSOURCE_HSE_DIVX;
PeriphClkInit.RTCClockSelection = (HSEDiv << HSESHIFT) | RCC_RTCCLKSOURCE_HSE_DIVX;
break;
}
}
Expand Down
Loading