K22 processor

Generale/ClassThreadAbstract.h

Committer:
bosko001
Date:
2021-05-16
Revision:
18:6196688e2a94
Parent:
7:4aa3dac73b66

File content as of revision 18:6196688e2a94:

#ifndef CLASSTHREADABSTRACT_H
#define CLASSTHREADABSTRACT_H

#include "mbed.h"

class C_thread
{
    Thread *p_t;
    public:

    C_thread(  )
    {
        p_t = new Thread( osPriorityNormal, 1000 );
        p_t ->start( [this](){thread_fun();});
    }
    C_thread(  uint32_t s  )
    {
        p_t = new Thread( osPriorityNormal, s);
        p_t ->start( [this](){thread_fun();});
    }
    C_thread( osPriority_t p, uint32_t s  )
    {
        p_t = new Thread( p, s);
        p_t ->start( [this](){thread_fun();});
    }
    virtual void thread_fun( void ) = 0;

    int get_max_stack( void ) { return p_t->max_stack();}
    int get_stack_ratio( void )  { return p_t->max_stack() * 100 / p_t->stack_size();}
};




#endif