functions from rtc_func transferred to class RTC8563
Fork of rtc_func by
Goto Inhalt
Diff: main.cpp
- Revision:
- 3:c6081814064d
- Parent:
- 2:f75062350241
- Child:
- 5:fc8c66a7c87a
diff -r f75062350241 -r c6081814064d main.cpp --- a/main.cpp Thu Apr 16 10:25:33 2015 +0000 +++ b/main.cpp Mon Apr 20 05:53:40 2015 +0000 @@ -5,50 +5,27 @@ description: Real Time Clock (RTC8563) on HIMBED M0 - LPC11U24 - prints formatted time and date values to serial port - programed by Franz Wolf (wf@bulme.at) + class Date inherited from class RTC8563 + Example methode GetDay implemented +ToDo: + implement year, month; ***********************************/ #include "mbed.h" #include "const.h" #include "RTC8563.h" #include "string" +#include "Date.h" Serial pc(USBTX, USBRX); -//I2C i2c(p28, p27); -uint8_t year, month, day, week; -uint8_t hour, minute, sec; -char week_chr[7][4] = {"MON","TUE","WED","THU","FRI","SAT","SUN"}; - +uint8_t year, month, day; + int main() { - RTC8563 rtc; // instanziieren des Objektes rtc - - pc.printf("Setting up RTC\n"); - //rtc.rtc_init(); + Date rtc; // instanziieren des Objektes rtc while(1) { - //printTime(); - year = rtc.rtc_read(YEARS); // Aufruf der Methode rtc_read der Instanz (Objekt) rtc - month = rtc.rtc_read(MONTHS); - day = rtc.rtc_read(DAYS); - week = rtc.rtc_read(WEEKDAYS); - hour = rtc.rtc_read(HOURS); - minute = rtc.rtc_read(MINUTES); - sec = rtc.rtc_read(SECONDS); - - //Datum Ausgabe - pc.printf("20%x%x/%x%x/%x%x %s\n", - ((year >> 4) & 0x03) , (year & 0x0F) , - ((month >> 4) & 0x01), (month & 0x0F) , - ((day >> 4) & 0x03), (day & 0x0F) , - week_chr[week & 0x07]); - - //Zeit Ausgabe - pc.printf("%x%x:%x%x:%x%x\n", - ((hour >> 4) & 0x03), (hour & 0x0F), - (minute >> 4), (minute & 0x0F) , - (sec >> 4), (sec & 0x0F) ); + pc.printf("____Date.Day: %i\n", rtc.GetDay()); wait(1); } } \ No newline at end of file