andysworkshop / stm32plus

The C++ library for the STM32 F0, F100, F103, F107 and F4 microcontrollers
http://www.andybrown.me.uk
Other
745 stars 224 forks source link

Persist rtc #164

Closed dholth closed 8 years ago

dholth commented 8 years ago

There you have it, my attempt at battery-persistent RTC for f0, f1, f4. Tested on f0. Reviewed the f1 stdlib example to find its backup function, but it has no use for the _hourFormat flag. At least the f1discovery comes with a populated LSE.

Usage:: Rtc<RtcLseClockFeature> rtc(RTC_HourFormat_24, 0xdeadbeef);

(change backup value if you want to force a reset of the backup domain and reinitialize the LSE)