Re-enable of interrupt is not working

Tushar Kanani
Posts: 3
Joined: Wed Apr 04, 2018 3:44 am

Re-enable of interrupt is not working

Postby Tushar Kanani » Wed Apr 04, 2018 3:53 am

Hi,

I am working on Interrupt. I need to disable and enable the interrupt run time.
Here is a piece of code that I am using to initialize the interrupt.

Code: Select all

#define GPIO_1 GPIO_NUM_25
gpio_set_direction(GPIO_1, GPIO_MODE_INPUT);
  gpio_set_pull_mode(GPIO_1,  GPIO_PULLUP_ONLY);
  attachInterrupt(digitalPinToInterrupt(GPIO_1), sw1_isr, CHANGE);
At some point of time I meed to disable the interrupt, for that I used.

Code: Select all

gpio_intr_disable(GPIO_1);
And after some time I need to re-enable it again.I do it using,

Code: Select all

gpio_intr_enable(GPIO_1);
But I found that, Once I disable the interrupt. I am not able to detect is even after I have enabled it as a mention.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Re-enable of interrupt is not working

Postby WiFive » Wed Apr 04, 2018 11:47 pm

Are you enabling it from a task running on a different core?

Tushar Kanani
Posts: 3
Joined: Wed Apr 04, 2018 3:44 am

Re: Re-enable of interrupt is not working

Postby Tushar Kanani » Thu Apr 05, 2018 3:35 am

Hi,

Thanks for response.
I am new to esp32 so, don't know how to make sure that "enabling it from a task running on a different core?"

But by another method, I am able to make it work as below.

Code: Select all

gpio_set_intr_type(GPIO_1, GPIO_INTR_DISABLE);
and

Code: Select all

gpio_set_intr_type(GPIO_1, GPIO_INTR_ANYEDGE);
insted of

Code: Select all

gpio_intr_disable(GPIO_1);
and

Code: Select all

gpio_intr_disable(GPIO_1);
.

Thanks.

Who is online

Users browsing this forum: No registered users and 10 guests