Advice on using RTC and WUTR on STM32F446 as a versatile timer and how to reset RTC->SSR?
I am working with the STM32F446 microcontroller and I would like to create a versatile timer function using the RTC:
typedef void (*timerCallback_t)();
void scheduleOneTimerEvent(uint32_t timeoutMs, timerCallback_t timerCallback);
I am considering using one WUTR interrupt for this and I would let ck_spre provide clock for the WUTR. Since I only care about WUTR (I won't use the RTC as a regular calendar clock at all) I will have varying frequencies on ck_spre, depending on what timeoutMs is set to (and for large timeoutMs I will need several "hidden" interrupts that don't call the timerCallback). Does anybody foresee any problems with this or have any general suggestions for improvement? Also, to keep things simple, I was planning to reset time to default whenever scheduleOneTimerEvent is called, but I read in the reference manual that the subsecond register (RTC->SSR) is read only, so how would I go about to reset it?