Library for Maxim DS3232M super-accurate, I2C based Real Time Clock chip with 234 bytes of user RAM. Library includes user RAM read/write operations along with CRC routines for accessing the user RAM area.

Dependents:   ds3232m_HelloWorld

Revision:
3:e9c5025ba2ca
Parent:
2:a9a8027a7cb2
Child:
4:b5acccb6c3d1
--- a/ds3232m.cpp	Thu Dec 25 21:38:22 2014 +0000
+++ b/ds3232m.cpp	Wed Mar 11 19:16:37 2015 +0000
@@ -198,6 +198,32 @@
 }
 
 //--------------------------------------------------------------------------------------------------------------------------------------//
+// get day of the week register (1 = Monday... 7 = Sunday)
+
+int ds3232m::getDayOfWeek() {
+    _i2c_->start();
+    _i2c_->write(RTCI2CADDRESS);
+    _i2c_->write(DS3232DAYOFWEEK);
+    _i2c_->start();
+    _i2c_->write(RTCI2CADDRESS + 1);
+    int dow3232 = (_i2c_->read(0));
+    _i2c_->stop();
+    return(BCDToDec(dow3232));
+}
+
+//--------------------------------------------------------------------------------------------------------------------------------------//
+// set day of the week register (1 = Monday... 7 = Sunday)
+
+void ds3232m::putDayOfWeek(char dow3232) {
+    dow3232 = dow3232 & 7;
+    _i2c_->start();
+    _i2c_->write(RTCI2CADDRESS);
+    _i2c_->write(DS3232DAYOFWEEK);
+    _i2c_->write(DecToBCD(dow3232));
+    _i2c_->stop();
+}
+
+//--------------------------------------------------------------------------------------------------------------------------------------//
 // clears all user memory inside the DS3232M.  Top 2 locations - reserved for CRC, also set to 00 since CRC value is 0x00 0x00
 
 void ds3232m::clearRAM() {