Page 1 of 1

GPT callback context information

Posted: Fri May 27, 2016 10:03 pm
by BingBang2222
Hello, I'm Vincenzo.
I'm quite experienced with C programming but I'm a newbie to ChibiOs and STM world, so I would like to say sorry in advance if I ask a n00b question. I was not able to find the answer to my question on the web nor on the docs.

I'm using the GPT driver to get a callback called at fixed intervals. I'd like to pass to this callback context information, you know, that void* pointer that you pass when register the callback function and is available between the parameters of the callback function every time it's called.

That's it, I was not able to find this mechanism in GPTDriver. Is this feature present but I cannot find it? Or is it absent? if so, is there a reason for the absence of that feature?

Thank you very much for your help,
regards,
Vincenzo

Re: GPT callback context information

Posted: Sat May 28, 2016 7:27 am
by Giovanni
Hi,

You can extend the GPTDriver structure using GPT_DRIVER_EXT_FIELDS, add there your parameters.

Giovanni

Re: GPT callback context information

Posted: Sat May 28, 2016 2:11 pm
by BingBang2222
Thank you, this solved my problem!
Vincenzo