Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of rtc_class by
Date.cpp
00001 #include "mbed.h" 00002 #include "const.h" 00003 #include "Date.h" 00004 00005 00006 uint8_t bcdToUint(uint8_t const nybbles) 00007 { 00008 uint8_t result; 00009 result = (nybbles >>4)*10 + (nybbles & 0x0F); 00010 return result; 00011 } 00012 00013 uint8_t Date::GetDay() 00014 { 00015 uint8_t day = rtc_read(DAYS); 00016 return bcdToUint(day & 0x3F); 00017 } 00018 uint8_t Date::GetMonth() 00019 { 00020 uint8_t month = rtc_read(MONTHS); 00021 return bcdToUint(month & 0x07F); 00022 } 00023 uint8_t Date::GetYear() 00024 { 00025 uint8_t year = rtc_read(YEARS); 00026 return bcdToUint(year & 0x3F); 00027 } 00028 uint8_t Date::GetWeek() 00029 { 00030 uint8_t week = rtc_read(WEEKDAYS); 00031 return bcdToUint(week & 0x07); 00032 }
Generated on Mon Jul 25 2022 14:22:31 by
1.7.2
