DS1337 RTC library RTC 55 bytes nvram

Files at this revision

API Documentation at this revision

Comitter:
labishrestha
Date:
Thu Oct 29 02:38:18 2015 +0000
Parent:
1:8a0e272ed8e6
Commit message:
Intermediate changes

Changed in this revision

ds1337.cpp Show annotated file Show diff for this revision Revisions of this file
ds1337.h Show annotated file Show diff for this revision Revisions of this file
--- a/ds1337.cpp	Wed Oct 28 23:20:29 2015 +0000
+++ b/ds1337.cpp	Thu Oct 29 02:38:18 2015 +0000
@@ -5,6 +5,7 @@
 DS1337::DS1337(PinName sda, PinName scl) : _i2c(sda, scl)
 {
     _i2c.frequency(DS1337_I2C_FCY);
+    memset(err, 0, ERR_BUFFER_LEN);
 }
 
 void DS1337::time2str(Time * t, char * str)
@@ -70,3 +71,4 @@
 
     return true;
 }
+
--- a/ds1337.h	Wed Oct 28 23:20:29 2015 +0000
+++ b/ds1337.h	Thu Oct 29 02:38:18 2015 +0000
@@ -7,6 +7,7 @@
 #define DS1337_ADDR         0x68<<1 /// I2C library needs address shifted left by 1-bit
 #define DS1337_BUFFER_SIZE  16      /// Max address for DS1337
 #define DS1337_I2C_FCY      300000  /// I2C frequency
+#define ERR_BUFFER_LEN      40
 
 typedef struct tm Time;
 
@@ -18,7 +19,7 @@
 public:
 
     /// String containing error code when command fails
-    char err[30];
+    char err[ERR_BUFFER_LEN];
     
     /** Create DS1337 instance on the specified pins of I2C bus
      */