This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/LAUNCHXL-CC2650: Task: changing arg0 on-the-fly and limit of Task_sleep

Part Number: LAUNCHXL-CC2650
Other Parts Discussed in Thread: CC2650

Tool/software: TI-RTOS

Hello,

For my project, I'm starting from example "project_zero_app_cc2650launchxl"

My goal is to blink the on board LED0 depending on a certain frequency.

To acheive that, I create a dedicated Task which arg0 is the bliking frequency. But can I change arg0 on-the-fly? (for example whenever I press an onboard Button)

1_ My solution is to Delete the current Task and Recreate a new one to specify the new arg0 but is there a mean to simply modify arg0 of the current Task?

    case Board_BUTTON1:


      ButtonService_SetParameter(BS_BUTTON1_ID,
                                 sizeof(pState->state),
                                 &pState->state);

      Log_info0("My task wil be deleted because of BUTTON1");

      Task_delete(&Task_Handle_LED);

      Frequency = Frequency - 25000;

      // new task will be created

     Task_Params_init(&taskParams);
      taskParams.arg0 = Frequency / Clock_tickPeriod;
      taskParams.stackSize = TASKSTACKSIZE;
      taskParams.stack = &task0Stack;
      Task_Handle_LED = Task_create((Task_FuncPtr)LEDtaskFxn, &taskParams, NULL);


      Log_info0("My task has been recreated");


      break;

 

2_Also, I have a strange behavior if  "taskParams.arg0" comes to value  25000 then the CC2650 LaunchPad blocks and I have to reset it to have it running again.

Do you have an explanation? 

(This is related to Task_sleep and For info,  Clock_tickPeriod  = 10)

 

Thank you!

John MC.