updated tinyRTC library

Dependents:   Pong PongGame MainSketch

Fork of RTC-DS1307 by Henry Leinen

Revision:
0:3940f0ad2ca5
Child:
1:64274190e842
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Rtc_Ds1307.cpp	Sun Jun 02 09:59:39 2013 +0000
@@ -0,0 +1,45 @@
+/* Rtc_Ds1307.cpp */
+
+#include "Rtc_Ds1307.h"
+
+#define _DEBUG 0
+
+
+#if (_DEBUG && !defined(TARGET_LPC11U24))
+#define INFO(x, ...) std::printf("[Rtc_Ds1307 : INFO]"x"\r\n", ##__VA_ARGS__);
+#define WARN(x, ...) std::printf("[Rtc_Ds1307 : WARN]"x"\r\n", ##__VA_ARGS__);
+#define ERR(x, ...) std::printf("[Rtc_Ds1307 : ERR]"x"\r\n", ##__VA_ARGS__);
+#else
+#define INFO(x, ...)
+#define WARN(x, ...)
+#define ERR(x, ...)
+#endif
+
+
+
+
+Rtc_Ds1307::Rtc_Ds1307(PinName sda, PinName scl)
+{
+    //  Create a new I2C object
+    m_rtc = new I2C(sda, scl);
+    if (m_rtc == NULL)
+        error("Rtc_Ds1307");
+}
+
+Rtc_Ds1307::~Rtc_Ds1307()
+{
+    if (m_rtc != NULL)
+        delete m_rtc;
+}
+
+bool Rtc_Ds1307::setTime(tm& time)
+{
+    INFO("Setting new time : %d:%d:%d\n", time.tm_hour, time.tm_min, time.tm_sec);
+    
+    return true;
+}
+
+bool Rtc_Ds1307::getTime(tm& time)
+{
+    return false;
+}