Working Version of the Real Time Clock module DS1307.
Dependents: Rtc_Ds1307_Sample TAREA_5_PROCESADORES Rtc_Ds1307_lcd_alarma Rtc_Ds1307_Reloj_con_alarma_aplazable ... more
This is my implementation of the DS1307.
I plan to add functionality which will make use of the OSC Input and which will increment the time continuously. A query to the module will then only have to be made when the MBED has been powered down.
Diff: Rtc_Ds1307.cpp
- Revision:
- 5:30531f2121a2
- Parent:
- 4:d2cc690aaac7
- Child:
- 7:dca20be3ef38
--- a/Rtc_Ds1307.cpp Sun Jun 23 16:29:35 2013 +0000 +++ b/Rtc_Ds1307.cpp Sun Jun 23 17:02:21 2013 +0000 @@ -1,8 +1,9 @@ /* Rtc_Ds1307.cpp */ - +#include "mbed.h" #include "Rtc_Ds1307.h" +#ifndef DEBUG //#define DEBUG -#undef DEBUG +#endif #include "debug.h" const char *Rtc_Ds1307::m_weekDays[] = { "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" }; @@ -25,7 +26,7 @@ delete m_rtc; } -bool Rtc_Ds1307::setTime(Time& time, bool start, bool thm) +bool Rtc_Ds1307::setTime(Time_rtc& time, bool start, bool thm) { char buffer[7]; INFO("reading clock registers to write the new time : %d:%d:%d\n", time.hour, time.min, time.sec); @@ -57,7 +58,7 @@ return true; } -bool Rtc_Ds1307::getTime(Time& time) +bool Rtc_Ds1307::getTime(Time_rtc& time) { char buffer[7]; bool thm = false; @@ -133,7 +134,7 @@ return true; } -bool Rtc_Ds1307::setSquareWaveOutput(bool ena, RateSelect_t rs) +bool Rtc_Ds1307::setSquareWaveOutput(bool ena, SqwRateSelect_t rs) { char reg; INFO("Reading register value first\n");