I’m trying to create a class that will be able to read pin states of my board (Nucleo-F411RE) using interruption. And when interrupted, send a callback to the object that has instantiated my class to notify this state change and send on Bluetooth the new state.
I’ve managed to receive the interruption in a thread:
_sendingThread.start(callback(&_eventQueue, &EventQueue::dispatch_forever)); _myInterruptIn.rise(_eventQueue.event(this, &Sensors::OnWheelRise));
_values = true;
I have several problems here, first the member variables such _sendCallback (bool) is not keeping its value in the thread, and how to create the SendCallback method that will be able to send the data on Bluetooth which has been created on the main thread.
I’m a bit lost on how, inside a class, to access the members across threads and to change the context between IRQ, secondary thread and main thread.
Thanks for your help.