This is a class for using the BQ32000 Real Time Clock chip from TI.

BQ32000

This is a class for using the BQ32000 Real Time Clock chip from TI.This is supossed to be pin and code compatible with the most usual DS1307. It is pin compatible as you can see:

/media/uploads/xeta05/bq32000.jpg

On the code side it is almost compatible, with some advanced functions added (trickle charge, calibration) and minor differences in the registers, For example is only capable of generating 1 Hz and 512 Hz square wave.

This library is based on the DS1307 library by Henry Leinen http://developer.mbed.org/users/leihen/code/RTC-DS1307/file/ee81f2c5a706

The trickle charge and calibration are included in the code but not tested against the chip.

Revision:
1:17f606b5b59b
Parent:
0:c12a004a9113
--- a/Rtc_bq32k.cpp	Thu Nov 27 16:45:51 2014 +0000
+++ b/Rtc_bq32k.cpp	Thu Nov 27 17:05:53 2014 +0000
@@ -1,9 +1,27 @@
+/* Rtc_bq32k.cpp */
+/*2014/11/27 Oskar Lopez de Gamboa
+*/
+/* Copyright (c) <2014> <Oskar Lopez de Gamboa>, MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
+ * and associated documentation files (the "Software"), to deal in the Software without restriction, 
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or 
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+ 
 #include "mbed.h"
 #include "Rtc_bq32k.h"
 
-
-
-
 const char *Rtc_bq32k::m_weekDays[] = { "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" };    
 
 
@@ -164,11 +182,11 @@
     char buffer2[2] = {(char)address, 0};
     
 //    m_rtc->start();
-    if (m_rtc->write(0xd0, buffer2, 1) != 0) {
+    if (m_rtc->write(BQ32000_ADDRESS, buffer2, 1) != 0) {
         m_rtc->stop();
         return false;
     }
-    if (m_rtc->read(0xd0, buffer, len) != 0) {return false;}
+    if (m_rtc->read(BQ32000_ADDRESS, buffer, len) != 0) {return false;}
     m_rtc->stop();
     return true;
 }
@@ -181,7 +199,7 @@
         buffer2[i+1] = buffer[i];
 
 //    m_rtc->start();        
-    if (m_rtc->write(0xd0, buffer2, len+1) != 0) 
+    if (m_rtc->write(BQ32000_ADDRESS, buffer2, len+1) != 0) 
     {
         m_rtc->stop();
         return false;