From f5fab98e4012ba1b0e518d2006b4218fe5e13bdc Mon Sep 17 00:00:00 2001 From: David Kotar Date: Tue, 7 Feb 2023 13:16:31 +0100 Subject: [PATCH] Add function timerAttachInterruptFlag --- cores/esp32/esp32-hal-timer.c | 8 ++++++-- cores/esp32/esp32-hal-timer.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cores/esp32/esp32-hal-timer.c b/cores/esp32/esp32-hal-timer.c index b6552b89377..87f48e5409c 100644 --- a/cores/esp32/esp32-hal-timer.c +++ b/cores/esp32/esp32-hal-timer.c @@ -221,11 +221,15 @@ bool IRAM_ATTR timerFnWrapper(void *arg){ return false; } -void timerAttachInterrupt(hw_timer_t *timer, void (*fn)(void), bool edge){ +void timerAttachInterruptFlag(hw_timer_t *timer, void (*fn)(void), bool edge, int intr_alloc_flags){ if(edge){ log_w("EDGE timer interrupt is not supported! Setting to LEVEL..."); } - timer_isr_callback_add(timer->group, timer->num, timerFnWrapper, fn, 0); + timer_isr_callback_add(timer->group, timer->num, timerFnWrapper, fn, intr_alloc_flags); +} + +void timerAttachInterrupt(hw_timer_t *timer, void (*fn)(void), bool edge){ + timerAttachInterruptFlag(timer, fn, edge, 0); } void timerDetachInterrupt(hw_timer_t *timer){ diff --git a/cores/esp32/esp32-hal-timer.h b/cores/esp32/esp32-hal-timer.h index 5bbed623586..5f0413b7445 100644 --- a/cores/esp32/esp32-hal-timer.h +++ b/cores/esp32/esp32-hal-timer.h @@ -36,6 +36,7 @@ void timerEnd(hw_timer_t *timer); void timerSetConfig(hw_timer_t *timer, uint32_t config); uint32_t timerGetConfig(hw_timer_t *timer); +void timerAttachInterruptFlag(hw_timer_t *timer, void (*fn)(void), bool edge, int intr_alloc_flags); void timerAttachInterrupt(hw_timer_t *timer, void (*fn)(void), bool edge); void timerDetachInterrupt(hw_timer_t *timer);