Timer callback as class instance
Posted: Tue Aug 16, 2022 2:04 pm
I'm having a really hard time passing an instance of a callback method that's in a class (C++), oto an esp_timer callback. I'm essentially trying to port some code from an old project to ESP and this old project uses a Timer class that allows you to pass in the function and the instance of that class then uses std::bind() to point to the callback method, and that's what gets passed into the Timer. However I seem to be unable to do this with esp_timer, regardless of my attempts.
I've created the esp_timer_create_args_t, and tried passing in any non-static function, but that never works. I even went as far as passing the return of std::bind() as the arg of the timer_args, and calling it within there, but I get an panic abort when I try to call the function.
Is there any simple way to create esp_timer_create_args_t and pass in an instance of a callback function?
I've created the esp_timer_create_args_t, and tried passing in any non-static function, but that never works. I even went as far as passing the return of std::bind() as the arg of the timer_args, and calling it within there, but I get an panic abort when I try to call the function.
Is there any simple way to create esp_timer_create_args_t and pass in an instance of a callback function?