Fresh McD
/
rtc_class3
rtc class
Fork of rtc_class by
Diff: Date.cpp
- Revision:
- 3:c6081814064d
- Child:
- 4:a4d39c018c65
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Date.cpp Mon Apr 20 05:53:40 2015 +0000 @@ -0,0 +1,17 @@ +#include "mbed.h" +#include "const.h" +#include "Date.h" + +// http://developer.mbed.org/teams/HIMBED_3AHELI/code/rtc_func/wiki/Homepage +uint8_t Date::bcdToUint(uint8_t const nybbles) +{ + uint8_t result; + result = (nybbles>>4)*10 + (nybbles & 0x0F); + return result; +} + +uint8_t Date::GetDay() +{ + uint8_t day = rtc_read(DAYS); + return bcdToUint(day & 0x3F); +} \ No newline at end of file