diff options
author | Joey Castillo <jose.castillo@gmail.com> | 2021-08-08 15:02:38 -0400 |
---|---|---|
committer | Joey Castillo <jose.castillo@gmail.com> | 2021-08-08 15:02:38 -0400 |
commit | e45fdf15afc2803b67d7a0bff15922315c1e11e7 (patch) | |
tree | b185bb5a436869447727f9e340402956264bccd9 /watch-library/hpl/rtc | |
parent | 27edc50be1326934a0a352fa0474e8715ed83f98 (diff) | |
download | Sensor-Watch-e45fdf15afc2803b67d7a0bff15922315c1e11e7.tar.gz Sensor-Watch-e45fdf15afc2803b67d7a0bff15922315c1e11e7.tar.bz2 Sensor-Watch-e45fdf15afc2803b67d7a0bff15922315c1e11e7.zip |
work on RTC tamper interrupt and external wake
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); } |