my programm rtc_class with functions in Date.cpp
Fork of rtc_func by
Revision 3:75f5352b387d, committed 2015-04-30
- Comitter:
- KagerJ
- Date:
- Thu Apr 30 10:53:00 2015 +0000
- Parent:
- 2:ce174a86d215
- Commit message:
- added GetDay() GetYear() GetWeek()
Changed in this revision
diff -r ce174a86d215 -r 75f5352b387d Date.cpp --- a/Date.cpp Thu Apr 23 09:42:34 2015 +0000 +++ b/Date.cpp Thu Apr 30 10:53:00 2015 +0000 @@ -25,7 +25,7 @@ uint8_t year = rtc_read(YEARS); return bcdToUint(year & 0x3F); } -uint8_t Date::GetWEEK() +uint8_t Date::GetWeek() { uint8_t week = rtc_read(WEEKDAYS); return bcdToUint(week & 0x07);
diff -r ce174a86d215 -r 75f5352b387d Date.h --- a/Date.h Thu Apr 23 09:42:34 2015 +0000 +++ b/Date.h Thu Apr 30 10:53:00 2015 +0000 @@ -12,6 +12,7 @@ uint8_t GetDay(); uint8_t GetMonth(); uint8_t GetYear(); + uint8_t GetWeek(); }; #endif \ No newline at end of file
diff -r ce174a86d215 -r 75f5352b387d DateString.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DateString.cpp Thu Apr 30 10:53:00 2015 +0000 @@ -0,0 +1,11 @@ +#include "DateString.h" +#include "RTC8563.h" + +//2. Methode überschreiben +uint8_t DateSting::GetDay() +{ + uint8_t day= Date::GetDay(); //Aufruf der GetDay- Methode aus Basisklasse Date mit Scope Operator + //Erweitern von Methoden der Basisklasse + day = day - 5; + return day; +} \ No newline at end of file
diff -r ce174a86d215 -r 75f5352b387d DateString.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DateString.h Thu Apr 30 10:53:00 2015 +0000 @@ -0,0 +1,16 @@ +#include "mbed.h" +#include "const.h" +#include "RTC8563.h" +#include "string" +#include "Date.h" + +#ifndef DATESTRING_H +#define DATESTRRING_H + +class DateString : public Date +{ + public: + uint8_t GetDay(); +}; + +#endif \ No newline at end of file
diff -r ce174a86d215 -r 75f5352b387d main.cpp --- a/main.cpp Thu Apr 23 09:42:34 2015 +0000 +++ b/main.cpp Thu Apr 30 10:53:00 2015 +0000 @@ -3,6 +3,7 @@ #include "RTC8563.h" #include "string" #include "Date.h" +#include "DateString.h" Serial pc(USBTX, USBRX); //I2C i2c(p28, p27);