Adafruit_RTCLib

Fork of Adafruit_RTCLib by Neal Horman

Committer:
nkhorman
Date:
Tue Jul 17 05:49:20 2012 +0000
Revision:
0:7f90c8e04249
Child:
1:2c4e81ecda67
land the adafruit rtc library with changes for LPC1768

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nkhorman 0:7f90c8e04249 1 // Code by JeeLabs http://news.jeelabs.org/code/
nkhorman 0:7f90c8e04249 2 // Released to the public domain! Enjoy!
nkhorman 0:7f90c8e04249 3
nkhorman 0:7f90c8e04249 4 /*
nkhorman 0:7f90c8e04249 5 * Taken from https://github.com/adafruit/RTClib
nkhorman 0:7f90c8e04249 6 * and modified for LPC1768 by Neal Horman July 2012
nkhorman 0:7f90c8e04249 7 * Also add support for access to the 56 bytes of
nkhorman 0:7f90c8e04249 8 * user accessible battery backed ram.
nkhorman 0:7f90c8e04249 9 */
nkhorman 0:7f90c8e04249 10
nkhorman 0:7f90c8e04249 11 #ifndef _DS1307_H_
nkhorman 0:7f90c8e04249 12 #define _DS1307_H_
nkhorman 0:7f90c8e04249 13
nkhorman 0:7f90c8e04249 14 #include "mbed.h"
nkhorman 0:7f90c8e04249 15 #include "DateTime.h"
nkhorman 0:7f90c8e04249 16
nkhorman 0:7f90c8e04249 17 // RTC based on the DS1307 chip connected via I2C and the Wire library
nkhorman 0:7f90c8e04249 18 class RtcDs1307
nkhorman 0:7f90c8e04249 19 {
nkhorman 0:7f90c8e04249 20 public:
nkhorman 0:7f90c8e04249 21 RtcDs1307(I2C &i2c);
nkhorman 0:7f90c8e04249 22 bool adjust(const DateTime& dt);
nkhorman 0:7f90c8e04249 23 bool isRunning();
nkhorman 0:7f90c8e04249 24 DateTime now();
nkhorman 0:7f90c8e04249 25 bool commit();
nkhorman 0:7f90c8e04249 26 uint8_t &operator[](uint8_t i) { return mRam[(i<sizeof(mRam)-1 ? i+1 : 0)]; };
nkhorman 0:7f90c8e04249 27 protected:
nkhorman 0:7f90c8e04249 28 I2C &mI2c;
nkhorman 0:7f90c8e04249 29 uint8_t mRam[1+56]; // device register address + 56 bytes
nkhorman 0:7f90c8e04249 30 };
nkhorman 0:7f90c8e04249 31
nkhorman 0:7f90c8e04249 32 #endif