Methods to access battery backed RAM #11

wants to merge 5 commits into


None yet
2 participants

dmalec commented Feb 23, 2012

Submitting the addition of two methods, readMemory and writeMemory, for consideration. The methods allow a sketch to make use of the battery backed RAM on the DS1307. I've tested on Arduino 1.0 and V23 on OSX 10.6 against the Adafruit DS1307 breakout board on an Arduino Uno.

dmalec added some commits Feb 23, 2012

Fixing issue where the current implementation of RTClib.cpp prevents …
…the use

of a global variable i in a sketch.  Instead of having a global int i, the
calls to send/write can be called with an explicit cast of 0 to a uint8_t.

dmalec commented Mar 13, 2012

Commit 597ec6a fixes an issue (seen on OSX with Arduino 0023 and 1.0) where 'i' can not be used as a global in a user sketch. Explicitly casting 0 to uint8_t in calls to send/write allows the compiler to disambiguate the function call without preventing sketches from using i. The problem can be seen by trying to verify the following sketch:

#include <Wire.h>
#include "RTClib.h"

int i;

void setup () {}
void loop () {}

Which will produce the following error :

RTClib/RTClib.cpp.o: In function `date2days':
/Users/dmalec/Documents/Arduino/libraries/RTClib/RTClib.cpp:26: multiple definition of `i'
ds1307.cpp.o:ds1307.cpp:10: first defined here

tdicola added a commit that referenced this pull request Jun 10, 2014

Merge pull request #26 from adafruit/square_wave
Add square wave output support from dmalec in pull #11.

tdicola commented Jun 10, 2014

Thanks so much for sending the great pull requests, and apologies they couldn't be reviewed sooner. For the nvmemory changes there are a few other pulls that suggested it--I'm going to review them all and pick one to integrate.

The square wave output pull is really nice. I just tested it out and it works well looking at the output in a scope. Since the pull is so old it couldn't be merged directly, so I pulled out the changes and added them separately with #26 . Also added a small note to the example that you need to put a pull up resistor from SQW to VCC. Thanks for submitting the pull request and apologies again that it couldn't be integrated sooner.

@tdicola tdicola closed this Jun 10, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment