Closed wh201906 closed 2 weeks ago
The formula for the timer period can also be found in the datasheet DS40001882D
30.6.2.6.3
31.6.2.5.5
In the current code, the +1
is ignored, so the register value is wrong.
Hello,
I appreciate what you did, but I won't consider merging this code now.
Because the code you modified has nothing to do with this formula.
And to be precise, you should modify the entire setPeriod function instead of the final result.
Like here: TimerTC3.cpp
The function
setPeriod()
sets the wrong register value. According to the comment, these timer library is inspired on the khoih-prog/SAMD_TimerInterrupt, which has the right code.For TC3: https://github.com/khoih-prog/SAMD_TimerInterrupt/blob/88c4a730ce3396cdf71f69936d24e6eb0d7f9b0a/src/SAMDTimerInterrupt.hpp#L424-L430 https://github.com/khoih-prog/SAMD_TimerInterrupt/blob/88c4a730ce3396cdf71f69936d24e6eb0d7f9b0a/src/SAMDTimerInterrupt.hpp#L724-L730 For TCC: https://github.com/khoih-prog/SAMD_TimerInterrupt/blob/88c4a730ce3396cdf71f69936d24e6eb0d7f9b0a/src/SAMDTimerInterrupt.hpp#L810-L812