diff options
author | Joey Castillo <jose.castillo@gmail.com> | 2021-08-10 22:07:30 -0400 |
---|---|---|
committer | Joey Castillo <jose.castillo@gmail.com> | 2021-08-10 22:07:30 -0400 |
commit | 1ab1d3fff2c4eb5b0ad52ae8001a39d1d023eb9c (patch) | |
tree | 347c4e6e5117e55f24b6038e7d32e83c787a7401 | |
parent | 0f49ed81509ad6dd4ddd18be2a93d4fd51b3b311 (diff) | |
download | Sensor-Watch-1ab1d3fff2c4eb5b0ad52ae8001a39d1d023eb9c.tar.gz Sensor-Watch-1ab1d3fff2c4eb5b0ad52ae8001a39d1d023eb9c.tar.bz2 Sensor-Watch-1ab1d3fff2c4eb5b0ad52ae8001a39d1d023eb9c.zip |
check if callback is null (could happen in wake from backup)
-rw-r--r-- | watch-library/hpl/rtc/hpl_rtc.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/watch-library/hpl/rtc/hpl_rtc.c b/watch-library/hpl/rtc/hpl_rtc.c index 437449ce..e580fa78 100644 --- a/watch-library/hpl/rtc/hpl_rtc.c +++ b/watch-library/hpl/rtc/hpl_rtc.c @@ -388,18 +388,24 @@ static void _rtc_interrupt_handler(struct calendar_dev *dev) uint16_t interrupt_enabled = hri_rtcmode0_read_INTEN_reg(dev->hw); if ((interrupt_status & interrupt_enabled) & RTC_MODE2_INTFLAG_ALARM0) { - dev->callback_alarm(); + if (dev->callback_alarm != NULL) { + dev->callback_alarm(); + } /* Clear interrupt flag */ hri_rtcmode0_clear_interrupt_CMP0_bit(dev->hw); } else if ((interrupt_status & interrupt_enabled) & RTC_MODE2_INTFLAG_PER7) { - dev->callback_tick(); + if (dev->callback_tick != NULL) { + dev->callback_tick(); + } /* Clear interrupt flag */ hri_rtcmode0_clear_interrupt_PER7_bit(dev->hw); } else if ((interrupt_status & interrupt_enabled) & RTC_MODE2_INTFLAG_TAMPER) { uint8_t reason = hri_rtc_get_TAMPID_reg(dev->hw, 0x1F); - dev->callback_tamper(reason); + if (dev->callback_tamper != NULL) { + dev->callback_tamper(reason); + } hri_rtc_write_TAMPID_reg(dev->hw, reason); /* Clear interrupt flag */ |