Demo program for mbed 5 thread start compile rerror
Fork of mbed-os-example-mbed5-blinky by
main.cpp
- Committer:
- Roietronics
- Date:
- 2016-11-04
- Revision:
- 20:34e8d1b03de2
- Parent:
- 19:1c65f0106b2c
File content as of revision 20:34e8d1b03de2:
#include "mbed.h"
#include "Thread.h"
#include "Callback.h"
DigitalOut led1(LED1);
#define mySignal 0x01
class MyTest
{
public:
osThreadId _id;
Thread _thread;
void myWorker(void const* arge)
{
MyTest* t = (MyTest*)arge;
int i;
i++;
osSignalSet(t->_id, mySignal);
}
MyTest(osThreadId id) :
_id(id),
_thread()
{
osStatus status = _thread.start(this, &MyTest::myWorker);
// osStatus status = _thread.start(mbed::Callback<void()>((MyTest*)this, &MyTest::myWorker));
}
};
// main() runs in its own thread in the OS
// (note the calls to Thread::wait below for delays)
int main() {
osThreadId id = Thread::gettid();
MyTest* test = new MyTest(id);
while (true) {
led1 = !led1;
Thread::wait(500);
}
}
