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.

LAUNCHXL-CC2640R2: simple peripheral and project zero QUEUE EVENT?

Part Number: LAUNCHXL-CC2640R2


Hi,

   The simple peripheral example program has handling for QUEUE EVENT. However the project zero example program don't have handling for QUEUE EVENT. Which one is correct implementation. Also for simple peripheral how does SBP_QUEUE_EVT get posted to Event_pend(). Because, I have not seen code that Event Post SBP_QUEUE_EVT.

simple_peripheral.c inside SimpleBLEPeripheral_taskFxn()

      // If RTOS queue is not empty, process app message.
      if (events & SBP_QUEUE_EVT)
      {
        while (!Queue_empty(appMsgQueue))
        {
          sbpEvt_t *pMsg = (sbpEvt_t *)Util_dequeueMsg(appMsgQueue);
          if (pMsg)
          {
            // Process message.
            SimpleBLEPeripheral_processAppMsg(pMsg);

            // Free the space from the message.
            ICall_free(pMsg);
          }
        }
      }

project_zero.c inside ProjectZero_taskFxn(). PRZ_QUEUE_EVT was not used in if condition.

      // Process messages sent from another task or another context.
      while (!Queue_empty(hApplicationMsgQ))
      {
        app_msg_t *pMsg = Queue_dequeue(hApplicationMsgQ);

        // Process application-layer message probably sent from ourselves.
        user_processApplicationMessage(pMsg);

        // Free the received message.
        ICall_free(pMsg);
      }

- kel

  • Hi,

    Any help regarding this? I am deciding whether to put the if condition below or not. Both CCS Projects are working for CC2640R2 Launchpad, so I am not sure what to do. However, since CC2640R2 uses events, it seems putting the if condition is the right way.

    if (events & SBP_QUEUE_EVT)

    - kel
  • Hi,

    The SBP_QUEUE_EVT and PRZ_QUEUE_EVT is posted through Util_enqueueMsg function which post "UTIL_QUEUE_EVENT_ID".
    In the project zero, Util_enqueueMsg is not used, therefore you don't see it in the task_fxn.

    Also in the simple_peripheral project, there are more events and different queue handles, which eventually calls different stuff. In stead of making a big function to distinguish all those different events(like project zero), it just separates those in the task_fxn. You can pick whatever you want to do with your structure.

    It might be easier to trace the code to have it the way that project zero does, but totally up to you.
  • Hi Christin,

    I will do the simple_peripheral way. I can see clearly Event Posting of UTIL_QUEUE_EVENT_ID inside Util_enqueueMsg. Also the if conditions are same as what is mentioned at your documentation.

    file:///C:/ti/simplelink_cc2640r2_sdk_1_00_00_22/docs/blestack/html/tirtos/rtos-overview.html#pending-on-an-event

    - kel