Working Version of the Real Time Clock module DS1307.

Fork of RTC-DS1307 by Henry Leinen

Files at this revision

API Documentation at this revision

Comitter:
sjj698
Date:
Wed Feb 19 13:30:05 2014 +0000
Parent:
9:5627b407e097
Commit message:
Changed time hour mask 196 to 192, as per data sheet, ignore bits 7 and 6 for hours (int)

Changed in this revision

Rtc_Ds1307.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Rtc_Ds1307.cpp	Wed Jun 26 21:05:46 2013 +0000
+++ b/Rtc_Ds1307.cpp	Wed Feb 19 13:30:05 2014 +0000
@@ -40,11 +40,11 @@
     buffer[1] = decimalToBcd(time.min);
     if (thm) {
         //  AM PM format
-        buffer[2] = (buffer[2]& 196) | (time.hour>12 ? (0x20 | ((decimalToBcd(time.hour-12)))) : decimalToBcd(time.hour));
+        buffer[2] = (buffer[2]& 192) | (time.hour>12 ? (0x20 | ((decimalToBcd(time.hour-12)))) : decimalToBcd(time.hour));
     }
     else {
         // 24 hours format
-        buffer[2] = (buffer[2]& 196) | (decimalToBcd(time.hour) & 0x3F);
+        buffer[2] = (buffer[2]& 192) | (decimalToBcd(time.hour) & 0x3F);
     }
     buffer[3] = time.wday;
     buffer[4] = decimalToBcd(time.date);