Re: k_timer


Johan Hedberg
 

Hi Flavio,

On Thu, Dec 08, 2016, Flavio Santes wrote:
After playing a bit with k_timer and the expiry and stop callbacks, I
realize that there is no way to manipulate application specific data
inside the callbacks. These routines are implemented by the user so it
makes sense that user-provided data can be manipulated inside expiry
and stop routines. What do you think?
At least I'm using CONTAINER_OF() to accomplish this. I think that's the
main idea of how these APIs are designed (same with k_work as well). So
you embed these objects in your "user data" struct and the get back your
own struct in the callback with the help of CONTAINER_OF.

Johan

Join devel@lists.zephyrproject.org to automatically receive all group messages.