Detecting which pin called the ISR Uno I need an answer fast.I want to make a keyboard class to handle a few buttons attached to my arduino. I want to use interrupts.The problem is I have to use the same interrupt function for all my buttons(it would beimpractical to create a routine for each button).So inside the routine I must know at least what pin fired the interrupt. How can I solve this?(I belive it can be solved by changing some registers but that would be too complicated).PS:there are only two buttons(pins 2 and 3 are enough)

Edit:
   Isn't possible to create/call an interrupt routine inside a class? (I know that the routine actually doesn't exist initially because the object of the class type wasn't created). Can this be done?

class Keyboard{
  private:
    struct btn{
      boolean pressed;
      uint32_t pressTime;
    };
    btn button1;

  public:
    void int_handler(){

    }
    Keyboard(){
      attachInterrupt(digitalPinToInterrupt(2),this-&gt;int_handler,RISING);
      attachInterrupt(digitalPinToInterrupt(3),this-&gt;int_handler,RISING);
    }
};
You only have two external interrupts on the Uno, so a simple solution would be to call an "intermediate" routine, which remembers the button number. eg.

  attachInterrupt(digitalPinToInterrupt(2),this-&gt;int_handler2,RISING);
  attachInterrupt(digitalPinToInterrupt(3),this-&gt;int_handler3,RISING);


Those two functions could then call your main function passing down 2 or 3 depending on which one was called.

eg.

void int_handler2 ()
  {
  int_handler (2);
  }

void int_handler3 ()
  {
  int_handler (3);
  }


If you have more switches than that you can use pin-change interrupts. The typical way of detecting which one fired is to see which bits are different this time, compared to last time.

See my page about interrupts.