![](/media/cache/group/HIMBED0.jpg.50x50_q85.jpg)
functions from rtc_func transferred to class RTC8563
Fork of rtc_func by
Goto Inhalt
DateString.cpp@10:83960ae8a0ee, 2015-04-30 (annotated)
- Committer:
- wolpra98
- Date:
- Thu Apr 30 10:48:18 2015 +0000
- Revision:
- 10:83960ae8a0ee
rtc_class;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wolpra98 | 10:83960ae8a0ee | 1 | #include "DateString.h" |
wolpra98 | 10:83960ae8a0ee | 2 | #include "RTC8563.h" |
wolpra98 | 10:83960ae8a0ee | 3 | |
wolpra98 | 10:83960ae8a0ee | 4 | uint8_t DateString::GetDay() |
wolpra98 | 10:83960ae8a0ee | 5 | { |
wolpra98 | 10:83960ae8a0ee | 6 | /*uint8_t day = rtc_read(DAYS); |
wolpra98 | 10:83960ae8a0ee | 7 | return bcdToUint(day&0x3F);*/ |
wolpra98 | 10:83960ae8a0ee | 8 | uint8_t day = Date::GetDay(); |
wolpra98 | 10:83960ae8a0ee | 9 | day=day-5; |
wolpra98 | 10:83960ae8a0ee | 10 | return day; |
wolpra98 | 10:83960ae8a0ee | 11 | } |
wolpra98 | 10:83960ae8a0ee | 12 | uint8_t DateString::GetMonth() |
wolpra98 | 10:83960ae8a0ee | 13 | { |
wolpra98 | 10:83960ae8a0ee | 14 | uint8_t months = rtc_read(MONTHS); |
wolpra98 | 10:83960ae8a0ee | 15 | return bcdToUint(months); |
wolpra98 | 10:83960ae8a0ee | 16 | } |
wolpra98 | 10:83960ae8a0ee | 17 | uint8_t DateString::GetYear() |
wolpra98 | 10:83960ae8a0ee | 18 | { |
wolpra98 | 10:83960ae8a0ee | 19 | uint8_t year = rtc_read(YEARS); |
wolpra98 | 10:83960ae8a0ee | 20 | return bcdToUint(year); |
wolpra98 | 10:83960ae8a0ee | 21 | } |
wolpra98 | 10:83960ae8a0ee | 22 | uint8_t DateString::GetNextDay() |
wolpra98 | 10:83960ae8a0ee | 23 | { |
wolpra98 | 10:83960ae8a0ee | 24 | uint8_t day = GetDay(); |
wolpra98 | 10:83960ae8a0ee | 25 | return ++day; |
wolpra98 | 10:83960ae8a0ee | 26 | } |
wolpra98 | 10:83960ae8a0ee | 27 | string DateString::GetDay(string str) |
wolpra98 | 10:83960ae8a0ee | 28 | { |
wolpra98 | 10:83960ae8a0ee | 29 | string day= str + " In Date Day: " + toString(GetDay()); |
wolpra98 | 10:83960ae8a0ee | 30 | return day; |
wolpra98 | 10:83960ae8a0ee | 31 | } |