Context
The delay timers in adc.c have the potential for overflow errors. If the cycle counter overflows while executing the delay, the code will not delay for long enough.
By my math, the cycle counter overflows every 21 seconds, while our delay is only 1.3us, so this issue is almost impossible to run into, but does exist.
Related Issues / PRs:
https://github.com/Severson-Group/AMDS/pull/102/changes#diff-05e9e0903c32c870e82e3d1636b3e1fc9d6406a5e6fdd06a5ea401380e1f4795R158
Approach
Use a new delay function which takes overflows into account.
Possibly write in ASM to remove compiler overhead?
Context
The delay timers in adc.c have the potential for overflow errors. If the cycle counter overflows while executing the delay, the code will not delay for long enough.
By my math, the cycle counter overflows every 21 seconds, while our delay is only 1.3us, so this issue is almost impossible to run into, but does exist.
Related Issues / PRs:
https://github.com/Severson-Group/AMDS/pull/102/changes#diff-05e9e0903c32c870e82e3d1636b3e1fc9d6406a5e6fdd06a5ea401380e1f4795R158
Approach
Use a new delay function which takes overflows into account.
Possibly write in ASM to remove compiler overhead?