Skip to content

Commit

Permalink
ta_disable_irq_handler should unarm its timer
Browse files Browse the repository at this point in the history
  • Loading branch information
peterharperuk committed Dec 6, 2024
1 parent 4b1b18f commit 2282b2b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ static inline void ta_enable_irq_handler(alarm_pool_timer_t *timer, uint alarm_n

static inline void ta_disable_irq_handler(alarm_pool_timer_t *timer, uint alarm_num, irq_handler_t irq_handler) {
uint irq_num = timer_hardware_alarm_get_irq_num(timer, alarm_num);
timer_hw_from_timer(timer)->armed = 1u << alarm_num; // disarm the timer
hw_clear_bits(&timer_hw_from_timer(timer)->inte, 1u << alarm_num);
irq_set_enabled(irq_num, true);
irq_remove_handler(irq_num, irq_handler);
Expand Down
2 changes: 1 addition & 1 deletion test/pico_time_test/pico_time_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@ int issue_2118_test(void) {
}
PICOTEST_CHECK(counter_2118 >= 100, "Repeating timer failure");

cancel_repeating_timer(&timer);
alarm_pool_destroy(pool);
hard_assert(timer_hw->armed == 0); // check destroying the pool unarms its timer

set_sys_clock_hz(SYS_CLK_HZ, true);
setup_default_uart();
Expand Down

0 comments on commit 2282b2b

Please sign in to comment.