Skip to content

Commit 14e21a9

Browse files
committed
BSP timer_if start alarm with a timeout expressed in tick unit
The timeout is a nb of tick counter (1/256Hz) in mix mode and must be converted in ms to match the RTC_StartAlarm API (1 tick is 3.9ms) Signed-off-by: Francois Ramu <francois.ramu@st.com>
1 parent cc45012 commit 14e21a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/BSP/timer_if.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ UTIL_TIMER_Status_t TIMER_IF_StartTimer(uint32_t timeout)
220220

221221
TIMER_IF_DBG_PRINTF("Start timer: time=%d, alarm=%d\n\r", GetTimerTicks(), timeout);
222222

223-
/* Program ALARM B on subsecond, mask is 32 (and fixed to RTC_ALARMMASK_ALL for calendar) */
224-
RTC_StartAlarm(RTC_ALARM_B, 0, 0, 0, 0, UINT32_MAX - timeout, RTC_HOURFORMAT12_PM, 31UL);
223+
/* Program ALARM B on timeout ticks converted in ms (one more for uncertainty, mask is 31 */
224+
RTC_StartAlarm(RTC_ALARM_B, 0, 0, 0, 0, (timeout * 1000 / MS_TO_TICK + 1), RTC_HOURFORMAT12_PM, 31UL);
225225

226226
/* USER CODE BEGIN TIMER_IF_StartTimer_Last */
227227

0 commit comments

Comments
 (0)