2014-06-10 01:14 AM
Hi,
I'm porting code from a M0 to an M3 part and libraries are quire a bit different. I need a quick tutorial on initializing the RTC and setting time and date using the stm32f103 part. I've already obtained the date and time. I just need to adjust the RTC to hold these values. Also, what function do I call to check the updated time and date once set? A code snippet would be great. Thank you Bob2014-06-10 04:39 AM
As I recall, the F1 uses a Seconds-since-Epoch model, like UNIX Time, so you have to write routines to translate back and forth to calender centric representations
2014-06-10 05:46 AM
In C you can store UTC time as a 32 bit uint (time_t (in the RTC registers)) or store calendar time as as (tm) type. Ignoring conversions for locale, use mktime() to convert from tm to time_t or use gmtime() to convert UTC time to a tm time struct.