IO plocana FRDM K64

Committer:
bosko001
Date:
Sun Mar 21 18:20:15 2021 +0100
Revision:
7:4aa3dac73b66
novi pocetak

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bosko001 7:4aa3dac73b66 1 #ifndef CLASSTHREADABSTRACT_H
bosko001 7:4aa3dac73b66 2 #define CLASSTHREADABSTRACT_H
bosko001 7:4aa3dac73b66 3
bosko001 7:4aa3dac73b66 4 #include "mbed.h"
bosko001 7:4aa3dac73b66 5
bosko001 7:4aa3dac73b66 6 class C_thread
bosko001 7:4aa3dac73b66 7 {
bosko001 7:4aa3dac73b66 8 Thread *p_t;
bosko001 7:4aa3dac73b66 9 public:
bosko001 7:4aa3dac73b66 10
bosko001 7:4aa3dac73b66 11 C_thread( )
bosko001 7:4aa3dac73b66 12 {
bosko001 7:4aa3dac73b66 13 p_t = new Thread( osPriorityNormal, 1000 );
bosko001 7:4aa3dac73b66 14 p_t ->start( [this](){thread_fun();});
bosko001 7:4aa3dac73b66 15 }
bosko001 7:4aa3dac73b66 16 C_thread( uint32_t s )
bosko001 7:4aa3dac73b66 17 {
bosko001 7:4aa3dac73b66 18 p_t = new Thread( osPriorityNormal, s);
bosko001 7:4aa3dac73b66 19 p_t ->start( [this](){thread_fun();});
bosko001 7:4aa3dac73b66 20 }
bosko001 7:4aa3dac73b66 21 C_thread( osPriority_t p, uint32_t s )
bosko001 7:4aa3dac73b66 22 {
bosko001 7:4aa3dac73b66 23 p_t = new Thread( p, s);
bosko001 7:4aa3dac73b66 24 p_t ->start( [this](){thread_fun();});
bosko001 7:4aa3dac73b66 25 }
bosko001 7:4aa3dac73b66 26 virtual void thread_fun( void ) = 0;
bosko001 7:4aa3dac73b66 27
bosko001 7:4aa3dac73b66 28 int get_max_stack( void ) { return p_t->max_stack();}
bosko001 7:4aa3dac73b66 29 int get_stack_ratio( void ) { return p_t->max_stack() * 100 / p_t->stack_size();}
bosko001 7:4aa3dac73b66 30 };
bosko001 7:4aa3dac73b66 31
bosko001 7:4aa3dac73b66 32
bosko001 7:4aa3dac73b66 33
bosko001 7:4aa3dac73b66 34
bosko001 7:4aa3dac73b66 35 #endif