Showing results for 
Search instead for 
Did you mean: 

STM32F401RE threads on bare metal

Associate II

I need to make a "multi threaded" application, my mentor told me this, and I quote 

you should create a thread by yourself
use any system timer, e.g. simple tick timer
I do not really understand this, but he gave me some example pseudocode, hopefully someone can decipher what he meant.


int main(void){

  uint8_t done{0};
  while (1)   
    if(done & 1)
    {// exactly 1 ms loop
      function_LED_1ms();  //< no any delay sould be contains!!!
      function_Input_1ms();//< no any delay sould be contains!!!
      function_ETC_1ms();  //< no any delay sould be contains!!!
    if(done & 0x80)
    {// exactly 1 sec loop for example
     // TODO something every 1 sec


Pavel A.
Evangelist III

>I do not really understand this

Better ask him, to avoid "broken phone" situation. People that teach software in various schools often have peculiar ideas about software, different from what professional developers can suggest.

Just note that he prefers C++, because of syntax in line 3.