pass arg to High resolution timer callback

kyrpav
Posts: 37
Joined: Wed Jan 29, 2020 8:27 am

pass arg to High resolution timer callback

Postby kyrpav » Sat Feb 12, 2022 2:03 pm

Hi i have a high resolution timer set like this.

Code: Select all

    
    esp_timer_handle_t timerHandle;
    const esp_timer_create_args_t timerArgs={
        .callback = onTimer,
        .arg = NULL,
        .dispatch_method = ESP_TIMER_TASK,
        .name = "Measurement",
        .skip_unhandled_events = false
    };
    esp_timer_create(&timerArgs,&timerHandle);
I can use start and stop of timer with the next functions.

Code: Select all

esp_timer_start_periodic(timerHandle,timeout_us);
    esp_timer_stop(timerHandle));
The onTimer callback function is this

Code: Select all

void onTimer(void *args){
    // print a message from args, pass value on notification
}
From which function can i pass the info to the args of the callback function. Except making the variables extern or static and have them in the c file. I want to be able to pass the args.

kyrpav
Posts: 37
Joined: Wed Jan 29, 2020 8:27 am

Re: pass arg to High resolution timer callback

Postby kyrpav » Sat Feb 12, 2022 2:23 pm

i will try to pass it in the .arg of the args of timer.

Who is online

Users browsing this forum: No registered users and 280 guests