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.

Control GPIO between advertisements?

I would like to set a GPIO port 5msec before an advertisement is generated and clear the GPIO quickly after the advert is sent. Advert period is 100msec.  How best to do this?

I am using SimpleBLEBroadcaster, but that is not critical. My advertising is unconnected undirected.

Thank you,

GG

  • I would suggest you using two events GPIO_EVT and ADVERTISE_EVT to serve your goal. Put  osal_start_timerEx( TaskID, GPIO_EVT, 95 ); somewhere that you want to start your advertising. Then add the following event processing in your xxx_ProcessEvent().

      if ( events & GPIO_EVT )
      {
        //Set GPIO here
        osal_start_timerEx( TaskID, ADVERTISE_EVT, 5 );
        return (events ^ GPIO_EVT);
      }

      if ( events & ADVERTISE_EVT )
      {
        //Clear GPIO here
        osal_start_timerEx( TaskID, GPIO_EVT, 95 );
        return (events ^ ADVERTISE_EVT);
      }