Is it better to use a hardware timer, or a freeRTOS Task with RTC for building a Metronome?
To build a metronome, I plan on using on using a freeRTOS task running a while(1) with RTC timestamps to trigger clock ticks.
The freeRTOS task will run high priority but yield to other tasks which will do other work like toggle leds or other pins. Using the timestamps, I can track and compensate for 'drift' between beats. Do I need the RTC clock for this approach? I don't want the metronome beats to lag/drift over long duration.
Should I use a hardware timer with interrupt instead? I'm trying to determine the best approach before I proceed.
Update: I'm now thinking of using a hardware timer to interrupt every 2ms and increment global variable ms_elapased and checking that variable in my freeRTOS Task's while(1) to play each 'beat'.
Thanks for any ideas!
