IO plocana FRDM K64

temp/thread_class.h

Committer:
bosko001
Date:
2021-04-30
Revision:
16:a3085300cac3
Parent:
7:4aa3dac73b66

File content as of revision 16:a3085300cac3:

#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