-
-
Notifications
You must be signed in to change notification settings - Fork 127
RtcDS3234 object
(under construction)
RtcDS3234 object provides access to all the functions of the DS3234 module. Along with date and time, this also includes setting alarms, retrieving the temperature, enabling the 32 kHz pin, and defining the square wave pin.
Construct a Rtc object using the provided WIRE method.
T_SPI_METHOD - the typename of the class to use for the wire method. SPIClass
is the normal hardware method class.
spi - the instance of the T_SPI_METHOD to use. SPI
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 SPI support.
#include <SPI.h>
#include <RtcDS3234.h>
RtcDS3234<SPIClass> Rtc(SPI);
If you want to use SoftwareWire library, you can replace the class and instance from the above with the one you include.
The normal begin method that should be called within Setup()
<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.
<return>, the temperature the module is current reading
This will turn off and on the special pin that will give a pulse at 32kHz rate.
enable - true to enable the pin, false to disable it
piMode - the mode to have the SquareWave pin act as. One of the following values valid.
DS3234SquareWavePin_ModeNone - disable the pin
DS3234SquareWavePin_ModeBatteryBackup - the pin will trigger when the external power is lower than the battery power
DS3234SquareWavePin_ModeClock - the pin will trigger at the frequency defined by SetSquareWavePinClockFrequency()
DS3234SquareWavePin_ModeAlarmOne - the pin will trigger with alarm one
DS3234SquareWavePin_ModeAlarmTwo - the pin will trigger with alarm two
DS3234SquareWavePin_ModeAlarmBoth - the pin will trigger with either of the alarms
When the SquareWave pin is enabled for the clock, this method will set at what frequency the pin will pulse.
freq - One of the follow is used to control it.
DS3234SquareWaveClock_1Hz - one per second
DS3234SquareWaveClock_1kHz - 1024 times per second
DS3234SquareWaveClock_4kHz - 4096 times a second
DS3234SquareWaveClock_8kHz - 8192 times a second
void SetAlarmOne(const DS3234AlarmOne& alarm)
Alarm one allows for setting an alarm that is accurate to the second with various modes.
alarm - a structure that defines all the properties to set the alarm one.
DS3234AlarmOne GetAlarmOne()
this will get the current settings for alarm one.
<return>, the structure for the current settings
void SetAlarmTwo(const DS3234AlarmTwo& alarm)
Alarm two allows for setting an alarm that is accurate to the minute with various modes.
alarm - a structure that defines all the properties to set the alarm two.
DS3234AlarmTwo GetAlarmTwo()
this will get the current settings for alarm two.
<return>, the structure for the current settings
This method must be called after an alarm is triggered otherwise it will not trigger again. It is used as a means to confirm you handled the alarm.
<return>, the flag that defines which alarms were still active when this method is called. The values can be checked using bit operations.
DS3234AlarmFlag_Alarm1 - flag value for alarm 1
DS3234AlarmFlag_Alarm2 - flag value for alarm 2
DS3234AlarmFlag_AlarmBoth - a value handy for checking for both
This will trigger a temperature compensation update internally to the RTC. This is used to more accurately keep time. It is rare that this needed as it already happens automatically about every 64 seconds.
block - set to true to not return from this call until the compensation update is finished.
(see DS3234 documentation)
Normal operation to keep the RTC Module within its accuracy specification does not require the user to manipulation the aging offset.
(see DS3234 documentation)
Normal operation to keep the RTC Module within its accuracy specification does not require the user to manipulation the aging offset.
memoryAddress - (0-54) the address within the memory of the RTC to store a value.
value - the 8 bit value to store.
memoryAddress - the address within the memory of the RTC to retrieve a value.
<return>, the value of that memory address
memoryAddress - 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 - 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.