bosko lekovic
/
IO_spi
IO spi
Diff: temp/thread_class.h
- Revision:
- 7:4aa3dac73b66
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/temp/thread_class.h Sun Mar 21 18:20:15 2021 +0100 @@ -0,0 +1,42 @@ +#ifndef THREAD_CLASS_H +#define THREAD_CLASS_H + +#include "mbed.h" + +class C_fun +{ + Thread *t; + + virtual void thread_fun( void ) { while( true) {} } + public: + C_fun();// { t.start( [this]() { thread_fun(); } ); } + C_fun( void(*pfun)(void) );// { t.start(pfun); } +} ; + + +C_fun::C_fun() +{ + Thread *t = new Thread( osPriorityNormal, 1000); + t->start( [this]() { thread_fun(); } ); +} + +C_fun::C_fun( void(*pfun)(void) ) +{ + Thread *t = new Thread( osPriorityNormal, 1000); + t->start(pfun); +} + + + +// class C_fun1: C_fun +// { +// void thread_fun( void ) override +// { while( true) {led3 = 0; wait_us(5000); led3 = 1; ThisThread::sleep_for(4s);} } + +// public: +// C_fun1( void ){} +// C_fun1( pfv fun): C_fun( fun){} +// } c_f1(t1fun), c_f2; + + +#endif \ No newline at end of file