I'm building a Roku IR remote which uses a 4x3 keypad for channel number input. I've got it working, but now need to do the sleep/wake stuff. For the wakeup, I want to enable pin change interrupts on the three Column pins, which would be set up as INPUT-PULLUP. The four Row pins would be set as OUTPUT, LOW. So pressing any key during sleep will bring one of the Column pins low, which would trigger the pin change interrupt and wake up the processor. Then the keypad.h library would take over and process the keypress.
The problem is that after waking, a number of keypresses will need to be processed before sending the IR commands and going back to sleep, and I need to disable the pin change interrupt while all that is going on. It seems to me that the best place to disable the interrupt is inside the ISR so switch bounce would not produce any additional triggers. In fact, that would be the only instruction in the ISR. Then I would re-enable the interrupt just before sleeping.
Does this make sense? Then the question is whether it matters which register I change to disable the interrupt. I could disable pin change interrupts by clearing PCICR, or I could clear the mask value in the relevant PCMSKx register. Would either work? Does it make any difference which one I use?
And then is there any way to tell the IDE not to include all the register pushing and popping that it automatically adds to an ISR? I'm only going to write an immediate value to a processor register, so there should be no need for the pushing and popping.
Edit: To match the keypad library, during sleep the Row pins would be INPUT-PULLUP, and the Column pins would be OUTPUT, LOW.