Skip to content

Commit 6011ba6

Browse files
committed
chore: use attachSecondsInterrupt from RTC
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 2a18b4b commit 6011ba6

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/BSP/timer_if.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -372,20 +372,14 @@ void TIMER_IF_DelayMs(uint32_t delay)
372372
/* USER CODE END TIMER_IF_DelayMs_Last */
373373
}
374374

375-
void HAL_RTCEx_SSRUEventCallback(RTC_HandleTypeDef *hrtc)
375+
WEAK void TIMER_IF_SSRUCallback(void *data)
376376
{
377-
(void)hrtc; // unused
378-
/* USER CODE BEGIN HAL_RTCEx_SSRUEventCallback */
379-
380-
/* USER CODE END HAL_RTCEx_SSRUEventCallback */
381-
/*called every 48 days with 1024 ticks per seconds*/
377+
(void)data;
378+
/* called every 48 days with 1024 ticks per seconds */
382379
TIMER_IF_DBG_PRINTF(">>Handler SSRUnderflow at %d\n\r", GetTimerTicks());
383-
/*Increment MSBticks*/
380+
/* Increment MSBticks */
384381
uint32_t MSB_ticks = TIMER_IF_BkUp_Read_MSBticks();
385382
TIMER_IF_BkUp_Write_MSBticks(MSB_ticks + 1);
386-
/* USER CODE BEGIN HAL_RTCEx_SSRUEventCallback_Last */
387-
388-
/* USER CODE END HAL_RTCEx_SSRUEventCallback_Last */
389383
}
390384

391385
uint32_t TIMER_IF_GetTime(uint32_t *mSeconds)

src/BSP/timer_if.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ uint32_t TIMER_IF_Convert_ms2Tick(uint32_t timeMilliSec);
130130
*/
131131
uint32_t TIMER_IF_Convert_Tick2ms(uint32_t tick);
132132

133+
/**
134+
* @brief rtc SSRU Event Callback
135+
* @param[in] data not used
136+
*/
137+
void TIMER_IF_SSRUCallback(void *data);
138+
133139
/**
134140
* @brief Get rtc time
135141
* @param[out] subSeconds in ticks

src/STM32LoRaWAN.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ bool STM32LoRaWAN::begin(_lora_band band)
7575
_rtc.begin(true, STM32RTC::HOUR_24);
7676
/* Attach the callback function before enabling Interrupt */
7777
_rtc.attachInterrupt(UTIL_TIMER_IRQ_MAP_PROCESS, STM32RTC::ALARM_B);
78+
_rtc.attachSecondsInterrupt(TIMER_IF_SSRUCallback);
7879
/* The subsecond alarm B is set during the StartTimerEvent */
7980

8081
UTIL_TIMER_Init(_rtc.getHandle());

0 commit comments

Comments
 (0)