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.

CCS/CC1310: Keep LED ON for more than 5 seconds

Part Number: CC1310

Tool/software: Code Composer Studio

We are using CCS v6 for the project.

The given Wake On Radio example for Rx section (rfWakeOnRadio_CC1310DK_7XD) is modified so the the blinking LED1 stays on and does not blink.  

In the original example the board LED (LED1) blinks ON & OFF when a packet is available.  But, we modified it so the LED1 stays ON when packets are available and would go OFF only when there is no packet and Tx stops sending anything.  The code for that particular section is shown below.

So, my question is how to make LED1 to stay ON for an additional 5 seconds after there is no packet?    We like to have LED1 to stay ON as long as there is a packet and stays ON for an additional 5 seconds after Tx stops sending any packet.

Any advice would be highly appreciated. 

Here is the core from rfWakeOnRadio_CC1310DK_7XD example for Rx section and the simple modification to keep LED1 ON (and not toggling):

void callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
{

    PIN_setOutputValue(ledPinHandle, Board_LED1, 0);

/* If we've received a new packet and it's available to read out */

if (e & RF_EventRxEntryDone)
    {
        do
        {

          /* Toggle LED1 on RX (The following line is Disabled) */
  //    PIN_setOutputValue(ledPinHandle, Board_LED1, !PIN_getOutputValue(Board_LED1));
 

/* Here the LED1 comes ON & stays ON if the new packet is available */
                      PIN_setOutputValue(ledPinHandle, Board_LED1, 1);


            /* Get current unhandled data entry */
            currentDataEntry = RFQueue_getDataEntry();

            /* Handle the packet data, located at &currentDataEntry->data:
             * - Length is the first byte with the current configuration
             * - Data starts from the second byte */
            packetLength      = *(uint8_t*)(&currentDataEntry->data);
            packetDataPointer = (uint8_t*)(&currentDataEntry->data + 1);

            /* This code block is added to avoid a compiler warning.
            * Normally, an application will reference these variables for
            * useful data. */
            volatile uint8_t dummy;
            dummy = packetLength;
            dummy = dummy + packetDataPointer[0];
        } while(RFQueue_nextEntry() == DATA_ENTRY_FINISHED);
    }
}

  • Hello Ahmad,
    There are multiple ways to do this. I can think of these.
    1. If you do not have any other tasks, you can use task_sleep to sleep for 5 seconds before turning off the LED.
    2. Set up a clock for 5 seconds period and have a clock_start in your callback function and have the LED to turn off in the clock function. You can refer to the clock example for more information.
    Regards,
    Prashanth