bosko lekovic
/
IO_board_K22
K22 processor
Diff: Generale/ClassThreadAbstract.h
- Revision:
- 7:4aa3dac73b66
diff -r 12b2660d7dff -r 4aa3dac73b66 Generale/ClassThreadAbstract.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Generale/ClassThreadAbstract.h Sun Mar 21 18:20:15 2021 +0100 @@ -0,0 +1,35 @@ +#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