-
-
Notifications
You must be signed in to change notification settings - Fork 128
RtcDS1307 object
RtcDS1307 object provides access to all the functions of the DS1307 module. Along with date and time, this also includes retrieving and setting data into the non-volatile memory and defining what the trigger square wave pin does.
Construct a Rtc object using the provided WIRE method.
T_WIRE_METHOD - the typename of the class to use for the wire method. TwoWire
is the normal hardware method class.
wire - the instance of the T_WIRE_METHOD to use. Wire
is the normal hardware instance to use.
Below is an example of how to create an instance of the object using the normal Arduino hardware Wire support.
#include <Wire.h>
#include <RtcDS1307.h>
RtcDS1307<TwoWire> Rtc(Wire);
If you want to use SoftwareWire library, you can replace the above with this and it will work.
#include <SoftwareWire.h>
#include <RtcDS1307.h>
SoftwareWire myWire(SDA, SCL); // replace with the pins you use
RtcDS1307<SoftwareWire> Rtc(myWire);
The normal begin method that should be called within Setup()
<return>, the error code from the last Wire transaction. After each method call below, you may check if this return value for an error. See https://www.arduino.cc/en/Reference/WireEndTransmission for values of this error.
<return>, the RTC has confidence in the date and time it returns. If this returns false it usually means the battery is dead or the date and time has never been set.
<return>, the actual clock is running on the RTC.
isRunning - set if the clock is running. If false then the time value will not progress.
dt - the date and time to set the RTC to.
<return>, the current date and time in the RTC.
memoryAddress - (0-54) the address within the memory of the RTC to store a value.
value - the 8 bit value to store.
memoryAddress - (0-54) the address within the memory of the RTC to retrieve a value.
<return>, the value of that memory address
memoryAddress - (0-54) the starting address within the memory of the RTC to copy the following buffer
pValue - the pointer to a buffer of bytes
countBytes - the number of bytes to copy
<return>, the number of bytes actually copied. This maybe smaller than countBytes due to reaching the end of the available memory address.
memoryAddress - (0-54) the starting address within the memory of the RTC to copy from
pValue - the pointer to a buffer of bytes to copy into
countBytes - the number of bytes to copy
<return>, the number of bytes actually copied. This maybe smaller than countBytes due to reaching the end of the available memory address.
piMode - the mode to have the SquareWave pin act as. One of the following values valid.
DS1307SquareWaveOut_1Hz - the pin will trigger high once a second
DS1307SquareWaveOut_4kHz - the pin will trigger high 4096 times a second
DS1307SquareWaveOut_8kHz - the pin will trigger high 8192 times a second
DS1307SquareWaveOut_32kHz - the pin will trigger high 32768 times a second
DS1307SquareWaveOut_High - the pin will remain high
DS1307SquareWaveOut_Low - the pin will remain low