Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MicroBitDALImageRewrite by
Diff: MicroBitMessageBus.cpp
- Revision:
- 2:6597fe50dc94
- Parent:
- 1:3e0360107f98
--- a/MicroBitMessageBus.cpp Thu Apr 16 13:50:24 2015 +0000
+++ b/MicroBitMessageBus.cpp Tue Apr 28 18:32:34 2015 +0000
@@ -5,12 +5,13 @@
*/
#include "MicroBitMessageBus.h"
+#include "MicroBitFiber.h"
/**
* Constructor.
* Create a new Message Bus Listener.
*/
-MicroBitListener::MicroBitListener(int id, int value, void (*handler)(MicroBitEvent *))
+MicroBitListener::MicroBitListener(int id, int value, void (*handler)(void))
{
this->id = id;
this->value = value;
@@ -75,7 +76,8 @@
while (l != NULL && l->id == evt->source)
{
if(l->value == MICROBIT_BUS_VALUE_ANY || l->value == evt->value)
- l->cb(evt);
+ //l->cb();
+ create_fiber(l->cb);
l = l->next;
}
@@ -84,7 +86,8 @@
l = listeners;
while (l != NULL && l->id == MICROBIT_BUS_ID_ANY)
{
- l->cb(evt);
+ //l->cb();
+ create_fiber(l->cb);
l = l->next;
}
@@ -110,7 +113,7 @@
* TODO: We currently don't support C++ member functions as callbacks, which we should.
*/
-void MicroBitMessageBus::listen(int id, int value, void (*handler)(MicroBitEvent *))
+void MicroBitMessageBus::listen(int id, int value, void (*handler)(void))
{
MicroBitListener *l, *p;
MicroBitListener *newListener = new MicroBitListener(id, value, handler);
