diff options
Diffstat (limited to 'watch-library/hpl/rtc')
-rw-r--r-- | watch-library/hpl/rtc/hpl_rtc.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/watch-library/hpl/rtc/hpl_rtc.c b/watch-library/hpl/rtc/hpl_rtc.c index 0d119da1..437449ce 100644 --- a/watch-library/hpl/rtc/hpl_rtc.c +++ b/watch-library/hpl/rtc/hpl_rtc.c @@ -327,8 +327,7 @@ int32_t _prescaler_register_callback(struct calendar_dev *const dev, calendar_dr return ERR_NONE; } -// TODO: refactor this so it doesn't take a callback (it will never get called anyway) -int32_t _extwake_register_callback(struct calendar_dev *const dev, calendar_drv_cb_t callback) +int32_t _extwake_register_callback(struct calendar_dev *const dev, calendar_drv_extwake_cb_t callback) { ASSERT(dev && dev->hw); @@ -389,16 +388,20 @@ 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(dev); + 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(dev); + 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); + hri_rtc_write_TAMPID_reg(dev->hw, reason); + /* Clear interrupt flag */ hri_rtcmode0_clear_interrupt_TAMPER_bit(dev->hw); } |