Add function timerAttachInterruptFlag (#7809)

This commit is contained in:
davidk88 2023-02-10 00:03:14 +01:00 committed by GitHub
parent e881d11bdb
commit b31c9361ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -221,11 +221,15 @@ bool IRAM_ATTR timerFnWrapper(void *arg){
return false; 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){ if(edge){
log_w("EDGE timer interrupt is not supported! Setting to LEVEL..."); 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){ void timerDetachInterrupt(hw_timer_t *timer){

View file

@ -36,6 +36,7 @@ void timerEnd(hw_timer_t *timer);
void timerSetConfig(hw_timer_t *timer, uint32_t config); void timerSetConfig(hw_timer_t *timer, uint32_t config);
uint32_t timerGetConfig(hw_timer_t *timer); 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 timerAttachInterrupt(hw_timer_t *timer, void (*fn)(void), bool edge);
void timerDetachInterrupt(hw_timer_t *timer); void timerDetachInterrupt(hw_timer_t *timer);