Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Detektor_Pokreta Dino_Martic_Programski
Revision 12:67d9685eaeb0, committed 2020-01-20
- Comitter:
- dmartic
- Date:
- Mon Jan 20 13:01:21 2020 +0000
- Parent:
- 11:ccfd683953ae
- Commit message:
- Izvorne datoteke za TinyRTC DS1307 sa I2C komunikacijom.
Changed in this revision
| Rtc_Ds1307.cpp | 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 |
--- a/Rtc_Ds1307.cpp Thu May 25 15:32:11 2017 +0000
+++ b/Rtc_Ds1307.cpp Mon Jan 20 13:01:21 2020 +0000
@@ -2,11 +2,11 @@
#include "Rtc_Ds1307.h"
#ifndef DEBUG
-//#define DEBUG
+#define DEBUG
#endif
#include "debug.h"
-const char *Rtc_Ds1307::m_weekDays[] = { "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" };
+const char *Rtc_Ds1307::m_weekDays[] = { "Ponedjeljak", "Utorak", "Srijeda", "Cetvrtak", "Petak", "Subota", "Nedjelja" };
Rtc_Ds1307::Rtc_Ds1307(PinName sda, PinName scl)
@@ -63,7 +63,6 @@
char buffer[7];
bool thm = false;
- INFO("Getting time from RTC\n");
if (!read(0, buffer, 7) ) {
// Failed to read
ERR("Failed to read from RTC\n");
@@ -178,7 +177,6 @@
}
m_rtc->stop();
- INFO("Successfully read %d registers from RTC\n", len);
return true;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/debug.h Mon Jan 20 13:01:21 2020 +0000
@@ -0,0 +1,19 @@
+//Debug library korišten za RTC1307
+
+#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