rtos - Why event flag related functions does not work correctly outside of tasks in keil rtx? -


as know event flags useful (e.g. let task running),but unfortunately control functions (os_evt_clr/set/wait) not work outside of tasks bodies correctly(e.g. in interrupt handling functions). alternative used variable ,i initialized in interrupt handler when needed ,then used on task running os_evt_set() function let mcu entering task.

    bool instance_variable;      interrupt_handler()     {     if(xxxx)     instance_variable=1     } //--------------------------             secondary_task()     {     //this run task     if(instance_variable==1)     {     os_evt_set (0x0001, primary_task_id);     instance_variable=0;     }     } //--------------------------         primary_task()     {     result = os_evt_wait_or (0x0001, 0xffff);     //task's body      os_evt_clr (0x0001, primary_task_id);     } 

any better approach?wbr.

you can't use function prefixed os_ inside isr. usage hints rtx documentation:

  • functions begin os_ can called task, not interrupt service routine.
  • functions begin isr_ can called irq interrupt service routine not task.

this code work:

interrupt_handler() {     if(xxxx) {          isr_evt_set (0x0001, primary_task_id);     } } //--------------------------         primary_task() {     result = os_evt_wait_or (0x0001, 0xffff);     //task's body      os_evt_clr (0x0001, primary_task_id); } 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -