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 mbed-os-example-mbed5-blinky by
main.cpp
00001 #include "mbed.h" 00002 #include "Thread.h" 00003 #include "Callback.h" 00004 00005 DigitalOut led1(LED1); 00006 00007 #define mySignal 0x01 00008 class MyTest 00009 { 00010 public: 00011 osThreadId _id; 00012 Thread _thread; 00013 00014 void myWorker(void const* arge) 00015 { 00016 MyTest* t = (MyTest*)arge; 00017 int i; 00018 i++; 00019 osSignalSet(t->_id, mySignal); 00020 } 00021 00022 MyTest(osThreadId id) : 00023 _id(id), 00024 _thread() 00025 { 00026 osStatus status = _thread.start(this, &MyTest::myWorker); 00027 // osStatus status = _thread.start(mbed::Callback<void()>((MyTest*)this, &MyTest::myWorker)); 00028 } 00029 00030 }; 00031 00032 // main() runs in its own thread in the OS 00033 // (note the calls to Thread::wait below for delays) 00034 int main() { 00035 osThreadId id = Thread::gettid(); 00036 MyTest* test = new MyTest(id); 00037 while (true) { 00038 led1 = !led1; 00039 Thread::wait(500); 00040 } 00041 } 00042
Generated on Mon Jul 25 2022 17:53:35 by
1.7.2
