8000 Guard RTC_GetFlagStatus body with if CIRCUITPY_RTC · domdfcoding/circuitpython@d6384f2 · GitHub
[go: up one dir, main page]

Skip to content

Commit d6384f2

Browse files
committed
Guard RTC_GetFlagStatus body with if CIRCUITPY_RTC
1 parent 7bc2436 commit d6384f2

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

ports/stm/supervisor/port.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,22 +197,24 @@ static volatile uint32_t systick_ms;
197197
* @retval The new state of RTC_FLAG (SET or RESET).
198198
*/
199199
FlagStatus RTC_GetFlagStatus(uint32_t RTC_FLAG) {
200-
FlagStatus bitstatus = RESET;
201-
uint32_t tmpreg = 0;
202-
200+
#if CIRCUITPY_RTC
201+
// Always reset if RTC disabled
202+
// RTC_FLAGS_MASK is not defined for all families e.g. stm32f7
203203
/* Check the parameters */
204204
assert_param(IS_RTC_GET_FLAG(RTC_FLAG));
205205

206206
/* Get all the flags */
207-
tmpreg = (uint32_t)(RTC->ISR & RTC_FLAGS_MASK);
207+
uint32_t tmpreg = (RTC->ISR & RTC_FLAGS_MASK);
208208

209209
/* Return the status of the flag */
210210
if ((tmpreg & RTC_FLAG) != (uint32_t)RESET) {
211-
bitstatus = SET;
211+
return SET;
212212
} else {
213-
bitstatus = RESET;
213+
return RESET;
214214
}
215-
return bitstatus;
215+
#else
216+
return RESET;
217+
#endif
216218
}
217219

218220

0 commit comments

Comments
 (0)
0