pass arg to High resolution timer callback

208 Views Asked by At

Hi i have a high resolution timer set like this.

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.

esp_timer_start_periodic(timerHandle,timeout_us);
    esp_timer_stop(timerHandle));

The onTimer callback function is this

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.

0

There are 0 best solutions below