From 14d4d2aacbbd64c3a4958d5f1207e0f426b186b1 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Tue, 18 Aug 2020 13:42:51 +0200 Subject: [PATCH] cpu/stm32/f1/rtt: don't trigger callbacks if unset --- cpu/stm32/periph/rtt_f1.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cpu/stm32/periph/rtt_f1.c b/cpu/stm32/periph/rtt_f1.c index ddfd1a72bb..31cd563b69 100644 --- a/cpu/stm32/periph/rtt_f1.c +++ b/cpu/stm32/periph/rtt_f1.c @@ -192,11 +192,15 @@ void RTT_ISR(void) { if (RTT_DEV->CRL & RTC_CRL_ALRF) { RTT_DEV->CRL &= ~(RTC_CRL_ALRF); - alarm_cb(alarm_arg); + if (alarm_cb) { + alarm_cb(alarm_arg); + } } if (RTT_DEV->CRL & RTC_CRL_OWF) { RTT_DEV->CRL &= ~(RTC_CRL_OWF); - overflow_cb(overflow_arg); + if (overflow_cb) { + overflow_cb(overflow_arg); + } } cortexm_isr_end(); }