rtc class

Dependencies:   RTC8563 mbed

Fork of rtc_class by HIMBED_3AHELI

Committer:
bulmecisco
Date:
Mon Apr 20 05:53:40 2015 +0000
Revision:
3:c6081814064d
Child:
4:a4d39c018c65
class Date inherited from class RTC8563; Example methode GetDay implemented

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bulmecisco 3:c6081814064d 1 #include "mbed.h"
bulmecisco 3:c6081814064d 2 #include "const.h"
bulmecisco 3:c6081814064d 3 #include "Date.h"
bulmecisco 3:c6081814064d 4
bulmecisco 3:c6081814064d 5 // http://developer.mbed.org/teams/HIMBED_3AHELI/code/rtc_func/wiki/Homepage
bulmecisco 3:c6081814064d 6 uint8_t Date::bcdToUint(uint8_t const nybbles)
bulmecisco 3:c6081814064d 7 {
bulmecisco 3:c6081814064d 8 uint8_t result;
bulmecisco 3:c6081814064d 9 result = (nybbles>>4)*10 + (nybbles & 0x0F);
bulmecisco 3:c6081814064d 10 return result;
bulmecisco 3:c6081814064d 11 }
bulmecisco 3:c6081814064d 12
bulmecisco 3:c6081814064d 13 uint8_t Date::GetDay()
bulmecisco 3:c6081814064d 14 {
bulmecisco 3:c6081814064d 15 uint8_t day = rtc_read(DAYS);
bulmecisco 3:c6081814064d 16 return bcdToUint(day & 0x3F);
bulmecisco 3:c6081814064d 17 }