Ds1307

Dependencies:   RTC-DS1307 TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
jyrodriguezg
Date:
Mon Jun 08 00:43:27 2015 +0000
Commit message:
Ds1307

Changed in this revision

RTC-DS1307.lib Show annotated file Show diff for this revision Revisions of this file
TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
debug.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RTC-DS1307.lib	Mon Jun 08 00:43:27 2015 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/leihen/code/RTC-DS1307/#5627b407e097
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Mon Jun 08 00:43:27 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/debug.h	Mon Jun 08 00:43:27 2015 +0000
@@ -0,0 +1,16 @@
+#ifndef __DEBUG_H__
+#define __DEBUG_H__
+
+
+#ifdef DEBUG
+#define INFO(x, ...) std::printf("[INFO: %s:%d]"x"\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
+#define WARN(x, ...) std::printf("[WARN: %s:%d]"x"\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
+#define ERR(x, ...) std::printf("[ERR: %s:%d]"x"\r\n", __FILE__, __LINE__, ##__VA_ARGS__);
+#else
+#define INFO(x, ...)
+#define WARN(x, ...)
+#define ERR(x, ...)
+#endif
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jun 08 00:43:27 2015 +0000
@@ -0,0 +1,23 @@
+#include "mbed.h"
+#include "Rtc_Ds1307.h"
+#include "TextLCD.h"
+
+ 
+Rtc_Ds1307 rtc(PTE0, PTE1);
+TextLCD lcd(PTE5, PTE4, PTE3, PTE2, PTB11, PTB10); // rs, e, d4-d7
+Serial pc(USBTX, USBRX, "pc");
+
+int main(){
+    Rtc_Ds1307::Time_rtc tm = {};
+    rtc.startClock();
+
+    while(1) {   
+         
+                    rtc.getTime(tm);
+                    lcd.locate(0,0);
+                    lcd.printf("Hora:%02d:%02d:%02d\n\r",tm.hour, tm.min, tm.sec); 
+                    lcd.locate(0,1);                         
+                    lcd.printf("Fech:%02d/%02d/%04d\n\r", tm.date, tm.mon, tm.year);
+                    
+                }
+            }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jun 08 00:43:27 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/dbbf35b96557
\ No newline at end of file