pass arg to High resolution timer callback
Posted: Sat Feb 12, 2022 2:03 pm
Hi i have a high resolution timer set like this.
I can use start and stop of timer with the next functions.
The onTimer callback function is this
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.
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);
Code: Select all
esp_timer_start_periodic(timerHandle,timeout_us);
esp_timer_stop(timerHandle));
Code: Select all
void onTimer(void *args){
// print a message from args, pass value on notification
}