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.

CC2541: Delay function for CC2541 in simplebleperipheral project

Part Number: CC2541

Hello,

i'm developing using IAR for CC2541. Need a delay function in the simplebleperipheral project, I read about HalLcd_HW_WaitUs  () function but i cant find it.

Can anyone help, please

Regards, 

Vito

  • Hi Vito,

    I suggest you use an OSAL timer for that purpose, similar to the periodic event.

  • Hi Joakim,

    I created the event and used the osal_Start_timerEx function, but it doesn work. Im developing using simple ble peripheral project on cc2541. After 10 seconds of advertising (general mode) i have to toggle a gpio pin. So I inserted the function 

    osal_start_timerEx( simpleBLEPeripheral_TaskID, SBP_DONE_EVT, SBP_DONE_EVT_PERIOD )

    in the GAPROLE_ADVERTISING case to generate a 10 seconds timer. (#define SBP_DONE_EVT_PERIOD    10000)

    Then i created the event, similar to the periodic event:

    if ( events & SBP_DONE_EVT )
    {
    // Restart timer
    if ( SBP_DONE_EVT_PERIOD )
    {
    osal_start_timerEx( simpleBLEPeripheral_TaskID, SBP_DONE_EVT, SBP_DONE_EVT_PERIOD );
    P1_7 = 1;   //GPIO pin toggle after 10 seconds
    }

    return (events ^ SBP_DONE_EVT);
    }

    Can you help me please?

    Regards, 

    Vito

  • Have you set breakpoint in code to verify that it does not work?

    Where are you clearing P1.7. To Toggle you should XOR the bit:

    P1_7 ^= 1;   //GPIO pin toggle after 10 seconds