Skip to content

Commit

Permalink
fix: build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
fpistm committed Sep 21, 2023
1 parent 50ffe71 commit 34744a6
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,9 @@ void RTC_GetDate(uint8_t *year, uint8_t *month, uint8_t *day, uint8_t *wday)
void RTC_StartAlarm(alarm_t name, uint8_t day, uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t subSeconds, hourAM_PM_t period, uint8_t mask)
{
RTC_AlarmTypeDef RTC_AlarmStructure = {0};

#if !defined(RTC_SSR_SS)
UNUSED(subSeconds);
#endif
/* Ignore time AM PM configuration if in 24 hours format */
if (initFormat == HOUR_FORMAT_24) {
period = HOUR_AM;
Expand Down Expand Up @@ -849,8 +851,6 @@ void RTC_StartAlarm(alarm_t name, uint8_t day, uint8_t hours, uint8_t minutes, u
} else {
RTC_AlarmStructure.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_ALL;
}
#else
UNUSED(subSeconds);
#endif /* RTC_SSR_SS */
if (period == HOUR_PM) {
RTC_AlarmStructure.AlarmTime.TimeFormat = RTC_HOURFORMAT12_PM;
Expand Down Expand Up @@ -880,7 +880,6 @@ void RTC_StartAlarm(alarm_t name, uint8_t day, uint8_t hours, uint8_t minutes, u
}
}
#else
UNUSED(subSeconds);
UNUSED(period);
UNUSED(day);
UNUSED(mask);
Expand All @@ -890,11 +889,12 @@ void RTC_StartAlarm(alarm_t name, uint8_t day, uint8_t hours, uint8_t minutes, u
HAL_RTC_SetAlarm_IT(&RtcHandle, &RTC_AlarmStructure, RTC_FORMAT_BIN);
HAL_NVIC_SetPriority(RTC_Alarm_IRQn, RTC_IRQ_PRIO, RTC_IRQ_SUBPRIO);
HAL_NVIC_EnableIRQ(RTC_Alarm_IRQn);
}
#if defined(RTC_ICSR_BIN)
} else if ((initMode == MODE_BINARY_MIX) || (initMode == MODE_BINARY_ONLY)) {
else if ((initMode == MODE_BINARY_MIX) || (initMode == MODE_BINARY_ONLY)) {
/* We have an SubSecond alarm to set in RTC_BINARY_MIX or RTC_BINARY_ONLY mode */
#else
} else {
else {
#endif /* RTC_ICSR_BIN */
#if defined(RTC_SSR_SS)
{
Expand All @@ -917,16 +917,14 @@ void RTC_StartAlarm(alarm_t name, uint8_t day, uint8_t hours, uint8_t minutes, u
/* The subsecond in ms is converted in ticks unit 1 tick is 1000 / fqce_apre */
RTC_AlarmStructure.AlarmTime.SubSeconds = UINT32_MAX - (subSeconds * fqce_apre) / 1000;
}

#else
UNUSED(subSeconds);
#endif /* RTC_SSR_SS */
/* Set RTC_Alarm */
HAL_RTC_SetAlarm_IT(&RtcHandle, &RTC_AlarmStructure, RTC_FORMAT_BIN);
HAL_NVIC_SetPriority(RTC_Alarm_IRQn, RTC_IRQ_PRIO, RTC_IRQ_SUBPRIO);
HAL_NVIC_EnableIRQ(RTC_Alarm_IRQn);
}
#if defined(RTC_ICSR_BIN)
} else {
else {
/* We have an SubSecond alarm to set in BCD (RTC_BINARY_NONE) mode */
#if defined(RTC_SSR_SS)
{
Expand All @@ -947,9 +945,6 @@ void RTC_StartAlarm(alarm_t name, uint8_t day, uint8_t hours, uint8_t minutes, u
}
RTC_AlarmStructure.AlarmTime.SubSeconds = subSeconds * fqce_apre / 1000;
}

#else
UNUSED(subSeconds);
#endif /* RTC_SSR_SS */
/* Set RTC_Alarm */
HAL_RTC_SetAlarm_IT(&RtcHandle, &RTC_AlarmStructure, RTC_FORMAT_BIN);
Expand Down

0 comments on commit 34744a6

Please sign in to comment.