c++11 / arm compiler v6.9 / keil5
i have 2 class ( class1, class2 ) - i whant send a function address from class1 to class 2, but i cant - i must define my function static - but i don't want do this
// ---------------------------- CLASS1.CPP ----------------------------
void CLASS1::ControlTransfer(uint8_t Physical_EPn, uint8_t bEPStatus) {
// ...
}
void CLASS1::init() {
class2.intHandler(2, ControlTransfer); // error: reference to non-static member function must be called
}
// ---------------------------- CLASS2.H ----------------------------
typedef void (TFnEPIntHandler) (uint8_t Physical_EPn, uint8_t bEPStatus);
// ---------------------------- CLASS2.CPP ----------------------------
TFnEPIntHandler *_apfnEPIntHandlers[16];
void CLASS2::intHandler( uint8_t num, TFnEPIntHandler *pfnHandler ) {
_apfnEPIntHandlers[ num ] = pfnHandler;
}
// _apfnEPIntHandlers used in my interrupt function
Aucun commentaire:
Enregistrer un commentaire