Go Down

Topic: Disabling interrupts (Read 401 times) previous topic - next topic

timtailors

Hi,

using this LowPower.attachInterruptWakeup()
https://www.arduino.cc/en/Reference/LowPowerAttachInterruptWakeup

After wake up i'll perfom a task and i need to disable a re-interrupt during this time. Only after the task is done it should be possible to interrupt again.
How can I do this?

PaulS

Quote
How can I do this?
sei()/cli()
-or-
interrupts()/noInterrupts()
The art of getting good answers lies in asking good questions.


timtailors

#3
Feb 08, 2019, 01:45 pm Last Edit: Feb 08, 2019, 01:46 pm by timtailors
Hi Paul, thanks I tried your suggestions and recognized that I need to disable only certain interrupts.
Is this also possible?

PaulS

Hi Paul, thanks I tried your suggestions and recognized that I need to disable only certain interrupts.
Is this also possible?
Which interrupts do you thing you need to disable? Which interrupts should remain enabled?
The art of getting good answers lies in asking good questions.

timtailors

#5
Feb 08, 2019, 04:20 pm Last Edit: Feb 08, 2019, 04:21 pm by timtailors
I have several triggers that wakes up the chip from sleep and also I need to wake up the chip when pressing the knob of an encoder.

LowPower.attachInterruptWakeup(TRIGGER_A_PIN, trigger_a_int_func, RISING);
LowPower.attachInterruptWakeup(TRIGGER_B_PIN, trigger_b_int_func, RISING);
LowPower.attachInterruptWakeup(ENCODER_KNOB_PIN, encoder_int_func, RISING);

The problem is that my menu library gets confused when I push the knob down as an interrupt is triggered even if the chip is already awake.
So my wish is to active interrupt capability right before sleeping for that encoder knob and disable interrupt -only of that knob- right after woken up.
I could nowhere find any solution to this that's why I create an issue because of the lacking information in the manual of this lib and hopefully add an explanation to the manual.  

PaulS

What you need to do is remove your interrupt handler and reassign it, as appropriate.

How you do that, with that library, I haven't a clue.

I suspect, though, that the real problem is with what you do in the interrupt service routine itself. Unless the ISR sets flags that the menu handler reads, the menu handler shouldn't even know that the encoder switch was pressed.

Typically, the wakeup handlers are supposed to do nothing more than handle the fact that the device is supposed to wake up. This would entail turning any capabilities back on that were turned off before the device went to sleep.
The art of getting good answers lies in asking good questions.

Go Up