Skip to content

Commit 54882c8

Browse files
FRASTMfpistm
authored andcommitted
chore: convert timeout (tick unit) to millisecond
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 bd6796a commit 54882c8

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
@@ -236,8 +236,8 @@ UTIL_TIMER_Status_t TIMER_IF_StartTimer(uint32_t timeout)
236236

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

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

242242
/* USER CODE BEGIN TIMER_IF_StartTimer_Last */
243243

0 commit comments

Comments
 (0)