Except for ESP32 (and ESP8266) where you can indeed specify an instance function as an ISR:
#include "FunctionalInterrupt.h"
class ClassWithIsr {
public:
ClassWithIsr(uint8_t p) : pin(p) {}
void begin() {
pinMode(pin, INPUT_PULLUP);
auto funct = [this] {
this->instanceIsr();
};
attachInterrupt(digitalPinToInterrupt(pin), funct, RISING);
}
private:
uint8_t pin;
void instanceIsr() {
//
// Handle Interrupt Here
//
}
};
ClassWithIsr testClass(1);
void setup() {
testClass.begin();
}
void loop() {
}