AVR sleep interrupt with keypad
When you will want your device to enter sleep mode you can change all the columns to OUTPUT and LOW. And enable the interrupt. Then diode-OR all of them together and bring that output to interrupt pin. Something like this:







simulate this circuit &ndash; Schematic created using CircuitLab

When either of the button is pressed the output from the diodes is LOW (~0.6V).

The pin of the interrupt should be configured as input with a internal pull-up.
In the ISR of that interrupt you should bring all of the column pins back to high impedance input. And disable further interrupts on this pin for debouncing purposes.