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 Erik -

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

Files at this revision

API Documentation at this revision

Comitter:
Gijsvanoort
Date:
Sat Feb 21 15:18:52 2015 +0000
Parent:
0:5e6107966aba
Child:
2:be7af7513a1b
Commit message:
Fixed bug which occurs when you define a different CE pin

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Mar 31 20:54:17 2014 +0000
+++ b/main.cpp	Sat Feb 21 15:18:52 2015 +0000
@@ -8,7 +8,7 @@
 #include "mbed.h"
 #include "DS1302.h"
 
-DS1302 clk(SCLK, IO, PTC3);
+DS1302 clk(SCLK, IO, CE);
 
 int main() {
     #ifdef INITIAL_RUN