Hello,
I still have problems attaching an Interrupt from within a Class. I guess I am doing some syntactic error or something wrong with the pointer. (Sorry I am a newbee to programming, Classes and OOP.)
I am getting the followig error:
In file included from NBS_Lib_V009.ino:33:0:
/tmp/build5142569924928438164.tmp/BS.h: In constructor 'BS::BS()':
/tmp/build5142569924928438164.tmp/BS.h:170:11: error: 'BS* BS::isr_handler' is a static data member; it can only be initialized at its definition
BS(): isr_handler(this);//{}
^
/tmp/build5142569924928438164.tmp/BS.h:170:27: error: expected '{' at end of input
BS(): isr_handler(this);//{}
^
Fehler beim Kompilieren.
My Headder File: BS.h
class BS{
private:
static BS* isr_handler;
//...and many more
protected:
void handle_isr(){ BS::RTCisr();} // RTCisr() contains the Code for the ISR
public:
//BS(); // my old Construcktor
BS(): isr_handler(this){}
static void sisr2() { if(isr_handler) isr_handler->handle_isr(); }
static void RTCisr(void); // psydo ISR called by real isr
//...and many more
File BS.cpp:
BS::BS(){ // BS Constructor
//...and many more
}
void BS::RTCisr(void){ //... } // psydo ISR called by real isr
void BS::setupISR(void){
attachInterrupt(4, isrRTC, RISING);
}
in Main .ino File:
void isrRTC(){
BS::sisr2();
}
Thank a lot in advance for any help and hints!! ![]()