rtc_class2

Dependencies:   RTC8563 mbed

Fork of rtc_class by HIMBED_3AHELI

Committer:
wolpra98
Date:
Thu Apr 30 10:48:18 2015 +0000
Revision:
6:83960ae8a0ee
rtc_class;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wolpra98 6:83960ae8a0ee 1 #include "DateString.h"
wolpra98 6:83960ae8a0ee 2 #include "RTC8563.h"
wolpra98 6:83960ae8a0ee 3
wolpra98 6:83960ae8a0ee 4 uint8_t DateString::GetDay()
wolpra98 6:83960ae8a0ee 5 {
wolpra98 6:83960ae8a0ee 6 /*uint8_t day = rtc_read(DAYS);
wolpra98 6:83960ae8a0ee 7 return bcdToUint(day&0x3F);*/
wolpra98 6:83960ae8a0ee 8 uint8_t day = Date::GetDay();
wolpra98 6:83960ae8a0ee 9 day=day-5;
wolpra98 6:83960ae8a0ee 10 return day;
wolpra98 6:83960ae8a0ee 11 }
wolpra98 6:83960ae8a0ee 12 uint8_t DateString::GetMonth()
wolpra98 6:83960ae8a0ee 13 {
wolpra98 6:83960ae8a0ee 14 uint8_t months = rtc_read(MONTHS);
wolpra98 6:83960ae8a0ee 15 return bcdToUint(months);
wolpra98 6:83960ae8a0ee 16 }
wolpra98 6:83960ae8a0ee 17 uint8_t DateString::GetYear()
wolpra98 6:83960ae8a0ee 18 {
wolpra98 6:83960ae8a0ee 19 uint8_t year = rtc_read(YEARS);
wolpra98 6:83960ae8a0ee 20 return bcdToUint(year);
wolpra98 6:83960ae8a0ee 21 }
wolpra98 6:83960ae8a0ee 22 uint8_t DateString::GetNextDay()
wolpra98 6:83960ae8a0ee 23 {
wolpra98 6:83960ae8a0ee 24 uint8_t day = GetDay();
wolpra98 6:83960ae8a0ee 25 return ++day;
wolpra98 6:83960ae8a0ee 26 }
wolpra98 6:83960ae8a0ee 27 string DateString::GetDay(string str)
wolpra98 6:83960ae8a0ee 28 {
wolpra98 6:83960ae8a0ee 29 string day= str + " In Date Day: " + toString(GetDay());
wolpra98 6:83960ae8a0ee 30 return day;
wolpra98 6:83960ae8a0ee 31 }