Init Scan Timer_1s Stop

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello everyone.

I have the following problem.

When I put in the code blecen_Scan the timer 1s stopped working.

Has anyone ever had a similar problem?

0 Likes
1 Solution

Ok, perhaps now I understand the question. If you initiate the blecen_scan in the create function, it will enter this state of scanning until it is interrupted. You will have to implement the blecen_scan(No scan) some where to interrupt/break it, then those timers will continue to work and count. Alternatively, don't start the scan in the create function, put it in an interrupt handler.

For example:

void app_create(void)

{

    bleprofile_Init(bleprofile_p_cfg);

    bleprofile_GPIOInit(bleprofile_gpio_p_cfg);

    // Enable Button Interrupt

  

    // register to process peripheral advertisements, notifications and indications

    blecm_RegleAdvReportCb((BLECM_FUNC_WITH_PARAM) advertisement_handler);

    blecen_Scan(NO_SCAN);

    bleprofile_regTimerCb(app_fine_timer, app_timer);

    bleprofile_StartTimer();

}

void app_fine_timer(UINT32 arg){}  //do nothing

void app_timer(UINT32 arg){

     ble_trace0("1s has elapsed");

}

The above will allow the timer to run, and if I apply an interrupt, the state will change to that of scanning. You may also want to implement a

callback when the scanning process ends, then the device will return to counting again. Insert some traces to show the executions.

View solution in original post

0 Likes
4 Replies