Skip to content

Commit 5da2cfc

Browse files
committed
refactor: update STM32RTC interrupt callbacks for ArduinoCore-API integration
Signed-off-by: Aymane Bahssain <aymane.bahssain@st.com>
1 parent eda2e0e commit 5da2cfc

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/STM32RTC.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ void STM32RTC::disableAlarm(Alarm name)
303303
* ALARM_A or ALARM_B if exists
304304
* @retval None
305305
*/
306-
void STM32RTC::attachInterrupt(voidFuncPtr callback, Alarm name)
306+
void STM32RTC::attachInterrupt(voidFuncPtrParam callback, Alarm name)
307307
{
308308
attachInterrupt(callback, nullptr, name);
309309
}
@@ -316,7 +316,7 @@ void STM32RTC::attachInterrupt(voidFuncPtr callback, Alarm name)
316316
* ALARM_A or ALARM_B if exists
317317
* @retval None
318318
*/
319-
void STM32RTC::attachInterrupt(voidFuncPtr callback, void *data, Alarm name)
319+
void STM32RTC::attachInterrupt(voidFuncPtrParam callback, void *data, Alarm name)
320320
{
321321
attachAlarmCallback(callback, data, static_cast<alarm_t>(name));
322322
}
@@ -338,7 +338,7 @@ void STM32RTC::detachInterrupt(Alarm name)
338338
* @param callback: pointer to the callback
339339
* @retval None
340340
*/
341-
void STM32RTC::attachSecondsInterrupt(voidFuncPtr callback)
341+
void STM32RTC::attachSecondsInterrupt(voidFuncPtrParam callback)
342342
{
343343
attachSecondsIrqCallback(callback);
344344
}
@@ -361,7 +361,7 @@ void STM32RTC::detachSecondsInterrupt(void)
361361
* @param callback: pointer to the callback
362362
* @retval None
363363
*/
364-
void STM32RTC::attachSubSecondsUnderflowInterrupt(voidFuncPtr callback)
364+
void STM32RTC::attachSubSecondsUnderflowInterrupt(voidFuncPtrParam callback)
365365
{
366366
attachSubSecondsUnderflowIrqCallback(callback);
367367
}

src/STM32RTC.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
|(STM32_RTC_VERSION_PATCH << 8U )\
6767
|(STM32_RTC_VERSION_EXTRA))
6868

69-
typedef void(*voidFuncPtr)(void *);
7069

7170
#if defined(RCC_RTC_WDG_BLEWKUP_CLKSOURCE_HSI64M_DIV2048) || defined(RCC_RTC_WDG_SUBG_LPAWUR_LCD_LCSC_CLKSOURCE_DIV512)
7271
#define IS_CLOCK_SOURCE(SRC) (((SRC) == STM32RTC::LSI_CLOCK) || ((SRC) == STM32RTC::LSE_CLOCK) ||\
@@ -158,19 +157,19 @@ class STM32RTC {
158157
void enableAlarm(Alarm_Match match, Alarm name = ALARM_A);
159158
void disableAlarm(Alarm name = ALARM_A);
160159

161-
void attachInterrupt(voidFuncPtr callback, Alarm name);
162-
void attachInterrupt(voidFuncPtr callback, void *data = nullptr, Alarm name = ALARM_A);
160+
void attachInterrupt(voidFuncPtrParam callback, Alarm name);
161+
void attachInterrupt(voidFuncPtrParam callback, void *data = nullptr, Alarm name = ALARM_A);
163162
void detachInterrupt(Alarm name = ALARM_A);
164163

165164
#ifdef ONESECOND_IRQn
166165
// Other mcu than stm32F1 will use the WakeUp feature to interrupt each second.
167-
void attachSecondsInterrupt(voidFuncPtr callback);
166+
void attachSecondsInterrupt(voidFuncPtrParam callback);
168167
void detachSecondsInterrupt(void);
169168

170169
#endif /* ONESECOND_IRQn */
171170
#ifdef STM32WLxx
172171
// STM32WLxx has a dedicated IRQ
173-
void attachSubSecondsUnderflowInterrupt(voidFuncPtr callback);
172+
void attachSubSecondsUnderflowInterrupt(voidFuncPtrParam callback);
174173
void detachSubSecondsUnderflowInterrupt(void);
175174
#endif /* STM32WLxx */
176175
// Kept for compatibility: use STM32LowPower library.

0 commit comments

Comments
 (0)