I use MODSERIAL as this:
MODSERIAL cmdUsb(USBTX, USBRX);
While it is possible to write
void rxCallbackUserContext(string str) {
cmdUsb.printf("Found string %s. \r\n", str.c_str());
}
and equeue this as
evntQueueUsbOut.call(rxCallbackUserContext, "! unknown command");
it seems not possible to enqueue directly in rxCallbackUserContext(string str)
that like
evntQueueUsbOut.call(&cmdUsb, &MODSERIAL::printf, "Found string %s. \r\n", str.c_str());
I receive the following
./mbed-os/events/EventQueue.h: In instantiation of 'void events::EventQueue::context<F, C0, C1>::operator()(ArgTs ...) [with ArgTs = {}; F = AjK::MODSERIAL*; C0 = int (mbed::Stream::*)(const char*, ...); C1 = const char*]':
./mbed-os/events/EventQueue.h:1233:18: required from 'static void events::EventQueue::function_call(void*) [with F = events::EventQueue::context<AjK::MODSERIAL*, int (mbed::Stream::*)(const char*, ...), const char*>]'
./mbed-os/events/EventQueue.h:754:27: required from 'int events::EventQueue::call(F) [with F = events::EventQueue::context<AjK::MODSERIAL*, int (mbed::Stream::*)(const char*, ...), const char*>]'
./mbed-os/events/EventQueue.h:766:53: required from 'int events::EventQueue::call(F, ArgTs ...) [with F = AjK::MODSERIAL*; ArgTs = {int (mbed::Stream::*)(const char*, ...), const char*}]'
./main.cpp:101:76: required from here
./mbed-os/events/EventQueue.h:1287:13: error: expression cannot be used as a function
1287 | f(c0, c1, args...);
| ^
Im not really a c++ programmer and im a bit shocked