I've got an F0 board with a battery backup on the RTC, so it would be convenient to have an RTC class that only resets the backup domain if it has not already been configured. In the STM32 example this is detected by reading a magic value from a backup register RTC_ReadBackupRegister(RTC_BKP_DR0) != BKP_VALUE (rather than a dedicated bit for this function that just detects if the calendar year is not 0...)
One strategy that I will try in my fork might be to have RtcBase check the backup register, add a flag on RtcBase, feature class resets or not based on flag. However as it is currently structured the magic number could not be a template argument? What if you want to reset the RTC again when the user sets the time just in case?
I've got an F0 board with a battery backup on the RTC, so it would be convenient to have an RTC class that only resets the backup domain if it has not already been configured. In the STM32 example this is detected by reading a magic value from a backup register
RTC_ReadBackupRegister(RTC_BKP_DR0) != BKP_VALUE
(rather than a dedicated bit for this function that just detects if the calendar year is not 0...)One strategy that I will try in my fork might be to have RtcBase check the backup register, add a flag on RtcBase, feature class resets or not based on flag. However as it is currently structured the magic number could not be a template argument? What if you want to reset the RTC again when the user sets the time just in case?