Page 1 of 1
C code for DS3231 & DS1307 RTCs
Posted:
Fri Apr 24, 2015 2:38 am
by rab
When I started playing with the esp8266 I couldn't find a lot of good C code examples (but quite a bit of LUA, which doesn't interest me). As a result I've written what I think are fairly decent drivers for the DS3231 & DS1307 RTCs using the C API, for use and for my learning. I hope they may be of use to others. They've had a good test, but please do report any bugs you might find.
http://richard.burtons.org/2015/04/23/r ... e-esp8266/Richard.
Re: C code for DS3231 & DS1307 RTCs
Posted:
Mon May 04, 2015 3:28 pm
by Rajeev
Hi Richard,
Thanks. I did see your posts and hope these would be of use. I have not yet tried but will make a note of it and try it sometimes.
Re: C code for DS3231 & DS1307 RTCs
Posted:
Tue Aug 11, 2015 10:32 am
by Baltasar
Hi Richard do you have some real examples using the RTC's, do I need to use something like wire lib to comunicate and use your driver?
I'm creating a timer for switching RGB lighs in certain hours so I need the RTC and also some way of storing the vars on the RTC Eprom module.
Thanks.
Re: C code for DS3231 & DS1307 RTCs
Posted:
Tue Aug 11, 2015 11:33 am
by rab
No extra libs needed. Just include i2c_master.h & .c from the sdk and set the right pins for I2C at the top of the header file. Then call i2c_master_gpio_init(); from your user_init function and you're good to go. You can then call the time or eeprom function to get/set time and read/write data to your heart's content.