Only 1) is an error.
Most RTCs have calendar-like registers like the mentioned RTCv2, Kinetis appears to be the exception with its 32 bits counter, the same solution of STM32F1 devices incidentally. This is why RTCv1 is not done yet, probably the code could be shared.
1980 is just a convenient year.
Giovanni
RTC driver for Kinetis.
Moderator: utzig
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
-
- Posts: 49
- Joined: Mon Aug 11, 2014 6:40 am
Re: RTC driver for Kinetis.
Giovanni,
I added conversions between RTCDateTime and time_t to the Kinetis rtc_lld.c based on the toolchain provided mktime() and localtime_r() functions.
The downside is that it adds 3.5K to the program size due to the library sizes. The code could definitely be renamed and shared.
1980 is the year that DOS uses as the epoch.
Derek
I added conversions between RTCDateTime and time_t to the Kinetis rtc_lld.c based on the toolchain provided mktime() and localtime_r() functions.
Code: Select all
void RTCDateTime2TimeT(time_t *tt, const RTCDateTime *dtp);
void TimeT2RTCDateTime(const time_t *tt, RTCDateTime *dtp);
The downside is that it adds 3.5K to the program size due to the library sizes. The code could definitely be renamed and shared.
1980 is the year that DOS uses as the epoch.
Derek
Re: RTC driver for Kinetis.
SpaceCoaster wrote:Hmmm, DST changes at between 2AM and 3AM in the US. Some nights have 2 x 2:30AM, some nights have none. Alarms which span DST changes would be tricky.
Absolutely that is a huge concern. DST makes things ugly. I have always wondered if the DST time change "repeated hour" or 2AM-3AM could play a part in some 2:30AM murder case where the suspect's alibi places him 50 miles from the crime scene at 2:30AM. But which 2:30AM is it?! There is not even a way to represent that!
UTC for the win.
Re: RTC driver for Kinetis.
Not all ports are going to have RTC. You can only rely on binary counters on Kinetic K2X or low end micros e.g. AVR.
So either you are going to need to emulate the RTC in software via 1 second interrupts or simply use binary counters for time stamps.
So either you are going to need to emulate the RTC in software via 1 second interrupts or simply use binary counters for time stamps.
Who is online
Users browsing this forum: No registered users and 1 guest