I guess there really isn't a right way. If you need to output a partial waveform, I'd reset the index and enable the timer's ISR in the loop(). Then when a given number of samples (sIndex) have elapsed from within the TC5_Handler(), I'd disable the ISR from within the ISR function itself. The timer would just free-run in the background.
1 Like