Skip to content

Commit

Permalink
Reverse renaming of getDate() and setDate(), now getDay() is calling …
Browse files Browse the repository at this point in the history
…getDate() and setDay() is calling setDate()
  • Loading branch information
hurik committed Apr 5, 2013
1 parent de2ad07 commit 6abd8c7
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
6 changes: 5 additions & 1 deletion README.md
Expand Up @@ -19,11 +19,15 @@ pin 13).

## Changelog

Version 0.95 -- Reverse renaming of getDate() and setDate(), now
getDay() is calling getDate() and setDay() is
calling setDate() & Readme improvements
by Sudar & Andreas Giemza (hurik)

Version 0.94 -- changed getDate() to getDay() and
setDate() to setDay() and updated
keywords.txt and the example
by Sudar & Andreas Giemza (hurik)

Version 0.93 -- added keywords.txt for syntax highlighting
by Andreas Giemza (hurik)
Version 0.92 RC -- Updated for Arduino 1.00; testing with
Expand Down
13 changes: 11 additions & 2 deletions RealTimeClockDS1307.cpp
Expand Up @@ -242,11 +242,15 @@ int RealTimeClockDS1307::getMonth()
//could mask with 0x1f but shouldn't need to
return bcdToDec(_reg5_month);
}
int RealTimeClockDS1307::getDay()
int RealTimeClockDS1307::getDate()
{
//could mask with 0x3f but shouldn't need to
return bcdToDec(_reg4_date);
}
int RealTimeClockDS1307::getDay()
{
return getDate();
}
int RealTimeClockDS1307::getDayOfWeek()
{
//could mask with 0x07 but shouldn't need to
Expand Down Expand Up @@ -392,13 +396,18 @@ void RealTimeClockDS1307::setDayOfWeek(int d)
}
}

void RealTimeClockDS1307::setDay(int d)
void RealTimeClockDS1307::setDate(int d)
{
if (d > 0 && d < 32)
{
_reg4_date = decToBcd(d);
}
}
void RealTimeClockDS1307::setDay(int d)
{
setDate(d);
}

void RealTimeClockDS1307::setMonth(int m)
{
if (m > 0 && m < 13)
Expand Down
4 changes: 3 additions & 1 deletion RealTimeClockDS1307.h
Expand Up @@ -77,6 +77,7 @@ class RealTimeClockDS1307
int getSeconds();
int getYear();
int getMonth();
int getDate();
int getDay();
int getDayOfWeek();
boolean is12hour();
Expand All @@ -102,7 +103,8 @@ class RealTimeClockDS1307
void switchTo24h();//returns immediately if already 24h
void switchTo12h();//returns immediately if already 12h
void setDayOfWeek(int);//incremented at midnight; not set by date (no fixed meaning)
void setDay(int);//allows 1-31 for *all* months.
void setDate(int);//allows 1-31 for *all* months.
void setDay(int);
void setMonth(int);
void setYear(int);

Expand Down
Expand Up @@ -185,7 +185,7 @@ void processCommand() {
case 'D':
case 'd':
in=SerialReadPosInt();
RTC.setDay(in);
RTC.setDate(in);
RTC.setClock();
Serial.print("Setting date to ");
Serial.println(in);
Expand Down
2 changes: 2 additions & 0 deletions keywords.txt
Expand Up @@ -25,6 +25,7 @@ getMinutes KEYWORD2
getSeconds KEYWORD2
getYear KEYWORD2
getMonth KEYWORD2
getDate KEYWORD2
getDay KEYWORD2
getDayOfWeek KEYWORD2
is12hour KEYWORD2
Expand All @@ -42,6 +43,7 @@ set24h KEYWORD2
switchTo24h KEYWORD2
switchTo12h KEYWORD2
setDayOfWeek KEYWORD2
setDate KEYWORD2
setDay KEYWORD2
setMonth KEYWORD2
setYear KEYWORD2
Expand Down

0 comments on commit 6abd8c7

Please sign in to comment.