Arduino-CommandParser
Arduino-CommandParser copied to clipboard
Using class member functions as command callback
Hi,
it looks like there is no easy way to "registerCommand" which should call member function of same class.
I've tried in this way:
commandParser.registerCommand("help", "", &cmd_displayHelp);
where "cmd_displayHelp" is member of same class.
It fails compilation with error: ISO C++ forbids taking the address of an unqualified or parenthesized non- static member function to form a pointer to member function. Say '&SerialController::cmd_displayHelp' [-fpermissive] commandParser.registerCommand("help", "", &cmd_displayHelp);
Had I forgot something or there is no way to do that with current syntax of "registerCommand"?
Thanks.