IO spi

temp/thread_class.h

Committer:
bosko001
Date:
2021-03-21
Revision:
7:4aa3dac73b66

File content as of revision 7:4aa3dac73b66:

#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