Updated Adafruit Library
Fork of Adafruit_RTCLib by
Revision 2:f372b273d88f, committed 2017-06-08
- Comitter:
- arsenalist
- Date:
- Thu Jun 08 15:26:26 2017 +0000
- Parent:
- 1:2c4e81ecda67
- Commit message:
- Use SoftI2C
Changed in this revision
DS1307.cpp | Show annotated file Show diff for this revision Revisions of this file |
DS1307.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 2c4e81ecda67 -r f372b273d88f DS1307.cpp --- a/DS1307.cpp Wed Jul 18 01:28:21 2012 +0000 +++ b/DS1307.cpp Thu Jun 08 15:26:26 2017 +0000 @@ -19,7 +19,7 @@ static uint8_t bcd2bin (uint8_t val) { return val - 6 * (val >> 4); } static uint8_t bin2bcd (uint8_t val) { return val + 6 * (val / 10); } -RtcDs1307::RtcDs1307(I2C &i2c) : mI2c(i2c) +RtcDs1307::RtcDs1307(SoftI2C &i2c) : mI2c(i2c) { // Read the RTC ram into the object RAM image mRam[0]=8;
diff -r 2c4e81ecda67 -r f372b273d88f DS1307.h --- a/DS1307.h Wed Jul 18 01:28:21 2012 +0000 +++ b/DS1307.h Thu Jun 08 15:26:26 2017 +0000 @@ -13,19 +13,20 @@ #include "mbed.h" #include "DateTime.h" +#include "SoftI2C.h" // RTC based on the DS1307 chip connected via I2C class RtcDs1307 { public: - RtcDs1307(I2C &i2c); + RtcDs1307(SoftI2C &i2c); bool adjust(const DateTime& dt); bool isRunning(); DateTime now(); bool commit(); uint8_t &operator[](uint8_t i) { return mRam[(i<sizeof(mRam)-1 ? i+1 : 0)]; }; protected: - I2C &mI2c; + SoftI2C &mI2c; uint8_t mRam[1+56]; // device register address + 56 bytes };