MAXIM DS3231 accurate Real Time Clock Library
Dependents: I2C-LCD-DHT22 wifigpslcd HomeStatus project ... more
Revision 1:84ccc64067d8, committed 2012-12-22
- Comitter:
- cromda
- Date:
- Sat Dec 22 19:56:16 2012 +0000
- Parent:
- 0:11dfd7ac4188
- Child:
- 2:6718c4fabf95
- Commit message:
- Add convert temperature function
Changed in this revision
DS3231.cpp | Show annotated file Show diff for this revision Revisions of this file |
DS3231.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/DS3231.cpp Sat Dec 22 19:23:19 2012 +0000 +++ b/DS3231.cpp Sat Dec 22 19:56:16 2012 +0000 @@ -25,7 +25,13 @@ int w=i2c.write(DS3231_Address,buf,1); int r=i2c.read(DS3231_Address,buf,2); error=((w!=0)||(r!=0)); - return(buf[0]+buf[1]/256.0);} + return(buf[0]+buf[1]/256.0);} + +// force temperatue conversion +void DS3231::convertTemperature() + {int Control=readRegister(DS3231_Control)|DS3231_bit_CONV; + writeRegister(DS3231_Control,Control); + } // decode time registers void DS3231::decodeTime(int regHours, int regMinutes, int regSeconds,int *Hours, int *Minutes, int *Seconds)
--- a/DS3231.h Sat Dec 22 19:23:19 2012 +0000 +++ b/DS3231.h Sat Dec 22 19:56:16 2012 +0000 @@ -145,6 +145,10 @@ */ void readTime(int *hours, int *minutes, int *seconds); + /** force temperature conversion + * + */ + void convertTemperature(); /** Set the time registers * @param hours