Skip to content

Commit

Permalink
Add function timerAttachInterruptFlag (#7809)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidk88 authored Feb 9, 2023
1 parent e881d11 commit b31c936
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cores/esp32/esp32-hal-timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
1 change: 1 addition & 0 deletions cores/esp32/esp32-hal-timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit b31c936

Please sign in to comment.