In some advanced use cases of General Purpose Timer (like a stepper-motors control loop) two useful routines are needed:
gptcnt_t gptGetCounter(GPTDriver gptp) — to get current counter value
gptcnt_t gptGetInterval(GPTDriver gptp) — to get last used interval
Hi,
This creates a portability issue because the counter behaviour is not specified, it could:
- Downward counting and reset to N.
- Upward counting and reset to zero.
- Ever increasing.
etc.
The interval should be possible.
Both have been added to ChibiOS 3.0. gptGetCounterX() has a note about the counter behavior.