Initialize clock chip to compile time the first time the program runs after that it will read the time from the clock chip. I find this easy since a quick recompile and load of utility sets the clock chip then we reload with the normal firmware. OK for use in low volume testing.
Dependencies: DS1302 compile_time_to_system_time mbed
Fork of DS1302_HelloWorld by
Initialize Clock To Compile Time
Initialize clock chip to compile time the first time the program runs after that it will read the time from the clock chip.
I find this an easy way to initialize my clock chip and then it stays set for as long as the battery lasts. I use a quick recompile then copy this utility to the mbed board where it sets the time and date. After than reload the mbed board with normal firmware and the clock remains set.
I use it for low volume testing.
Underlying library for parsing DATE and TIME is as follows:
The time supplied by compiler is UMT so you need to adjust for local time if needed.
Referenced
- https://developer.mbed.org/users/petereiso/notebook/cc-time-functions/
- http://stackoverflow.com/questions/1765014/convert-string-from-date-into-a-time-t
History
update to use MIT license
2016-03-30, by joeata2wh [Wed, 30 Mar 2016 14:50:02 +0000] rev 3
update to use MIT license
works on STM-F401RE
2016-03-28, by joeata2wh [Mon, 28 Mar 2016 05:58:07 +0000] rev 2
works on STM-F401RE
Fixed bug which occurs when you define a different CE pin
2015-02-21, by Gijsvanoort [Sat, 21 Feb 2015 15:18:52 +0000] rev 1
Fixed bug which occurs when you define a different CE pin
v1.0
2014-03-31, by Sissors [Mon, 31 Mar 2014 20:54:17 +0000] rev 0
v1.0
;