Tuesday, 12 June 2018

mbed EventQueue call


I'm trying to make an EventQueue call inside a method attached to a Ticker. The EventQueue, and context thread is declared within the class which holds the method in question. A simplified example:


    class EventHandler
{
public:


EventHandler() {

t.set_priority(osPriorityRealtime);
t.start(callback(&queue, &EventQueue::dispatch_forever));

}

void handler() {

//Do whatever


queue.call(&exobj, &ExampleObject::update, 0x0); //call update within user context, with state exobj, and parameter 0x0

}

private:

ExampleObject exobj;
Thread t;
EventQueue queue;

}

Main File:


int main() {
EventHandler eventhandler;
Ticker tick;
tick.attach(&eventhandler, EventHandler::handler, 1); //call handle periodically
}

On compilation, the following error is displayed:



Error: Expression preceding parentheses of apparent call must have (pointer-to-) function type in "extras/mbed-os.lib/events/EventQueue.h", Line: 2883, Col: 14

Can anyone explain this? I have followed the correct syntax for making calls on the EventQueue




No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...