diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-11-17 22:11:47 -0700 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-11-19 20:24:20 -0700 |
commit | ac008eb74171080114d1c41a233da5262937e604 (patch) | |
tree | c5ced10af9fd42e51dc15fbe840994583d2835d4 /libhw/rp2040_hwtimer.c | |
parent | 91fefb09f03cc49966aee1a7c371f439d1834a4b (diff) |
libhw: Fix hwtimer from triggering an interrupt way too often
Diffstat (limited to 'libhw/rp2040_hwtimer.c')
-rw-r--r-- | libhw/rp2040_hwtimer.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libhw/rp2040_hwtimer.c b/libhw/rp2040_hwtimer.c index 9af499a..4499642 100644 --- a/libhw/rp2040_hwtimer.c +++ b/libhw/rp2040_hwtimer.c @@ -87,7 +87,8 @@ static void rp2040_hwtimer_intrhandler(void) { trigger->prev = NULL; } - hw_clear_bits(&timer_hw->intf, 1 << alarm_num); + hw_clear_bits(&timer_hw->intf, 1 << alarm_num); /* Clear "force"ing the interrupt. */ + hw_clear_bits(&timer_hw->intr, 1 << alarm_num); /* Clear natural firing of the alarm. */ if (alarmclock->queue) timer_hw->alarm[alarm_num] = (uint32_t)NS_TO_US_ROUNDUP(alarmclock->queue->fire_at_ns); } @@ -132,7 +133,7 @@ static bool rp2040_hwtimer_add_trigger(implements_alarmclock *_alarmclock, alarmclock->initialized = true; } if (alarmclock->queue == trigger) { - /* Force the interrupt handler to trigger as soon as + /* "Force" the interrupt handler to trigger as soon as * we enable interrupts. This handles the case of * when fire_at_ns is before when we called * cr_save_and_disable_interrupts(). We could check |