@@ -79,7 +79,6 @@ volatile bool sleep_manager_locked = false;
79
79
80
80
static int LPTICKER_inited = 0 ;
81
81
static void LPTIM1_IRQHandler (void );
82
- static void (* irq_handler )(void );
83
82
84
83
void lp_ticker_init (void )
85
84
{
@@ -211,19 +210,15 @@ static void LPTIM1_IRQHandler(void)
211
210
/* We're already in handler and interrupt might be pending,
212
211
* so clear the flag, to avoid calling irq_handler twice */
213
212
__HAL_LPTIM_CLEAR_FLAG (& LptimHandle , LPTIM_FLAG_CMPM );
214
- if (irq_handler ) {
215
- irq_handler ();
216
- }
213
+ lp_ticker_irq_handler ();
217
214
}
218
215
219
216
/* Compare match interrupt */
220
217
if (__HAL_LPTIM_GET_FLAG (& LptimHandle , LPTIM_FLAG_CMPM ) != RESET ) {
221
218
if (__HAL_LPTIM_GET_IT_SOURCE (& LptimHandle , LPTIM_IT_CMPM ) != RESET ) {
222
219
/* Clear Compare match flag */
223
220
__HAL_LPTIM_CLEAR_FLAG (& LptimHandle , LPTIM_FLAG_CMPM );
224
- if (irq_handler ) {
225
- irq_handler ();
226
- }
221
+ lp_ticker_irq_handler ();
227
222
}
228
223
}
229
224
@@ -265,7 +260,6 @@ uint32_t lp_ticker_read(void)
265
260
void lp_ticker_set_interrupt (timestamp_t timestamp )
266
261
{
267
262
LptimHandle .Instance = LPTIM1 ;
268
- irq_handler = (void (* )(void ))lp_ticker_irq_handler ;
269
263
core_util_critical_section_enter ();
270
264
271
265
/* Always store the last requested timestamp */
@@ -330,7 +324,6 @@ void lp_ticker_fire_interrupt(void)
330
324
lp_Fired = 1 ;
331
325
/* In case we fire interrupt now, then cancel pending programing */
332
326
lp_delayed_prog = false;
333
- irq_handler = (void (* )(void ))lp_ticker_irq_handler ;
334
327
NVIC_SetPendingIRQ (LPTIM1_IRQn );
335
328
NVIC_EnableIRQ (LPTIM1_IRQn );
336
329
core_util_critical_section_exit ();
@@ -351,8 +344,8 @@ void lp_ticker_disable_interrupt(void)
351
344
sleep_manager_unlock_deep_sleep ();
352
345
sleep_manager_locked = false;
353
346
}
354
- irq_handler = NULL ;
355
347
lp_delayed_prog = false;
348
+ lp_Fired = 0 ;
356
349
NVIC_DisableIRQ (LPTIM1_IRQn );
357
350
NVIC_ClearPendingIRQ (LPTIM1_IRQn );
358
351
LptimHandle .Instance = LPTIM1 ;
0 commit comments