rtc_class

Dependencies:   RTC8563 mbed

Fork of rtc_class by HIMBED_3AHELI

Files at this revision

API Documentation at this revision

Comitter:
Gm_070
Date:
Thu Apr 30 10:54:02 2015 +0000
Parent:
9:83be0e4edb52
Commit message:
1

Changed in this revision

Date.cpp Show annotated file Show diff for this revision Revisions of this file
Date.h Show annotated file Show diff for this revision Revisions of this file
DateString.cpp Show annotated file Show diff for this revision Revisions of this file
DateString.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 83be0e4edb52 -r 83c6939656e5 Date.cpp
--- a/Date.cpp	Thu Apr 23 10:44:24 2015 +0000
+++ b/Date.cpp	Thu Apr 30 10:54:02 2015 +0000
@@ -1,21 +1,6 @@
-/***********************************
-name:   date.cpp    Version: 0.5
-author: PE HTL BULME
-email:  pe@bulme.at
-description:
-    Real Time Clock (RTC8563) on HIMBED M0 - LPC11U24 
-    class Date inherited from class RTC8563
-    Example methode GetDay implemented 
-ToDo: 
-    implement GetYear, GetMonth;
-    Constructor to initialize Date on RTC
-    Alarm methode
-***********************************/
-
 #include "mbed.h"
 #include "Date.h"
 
-// https://developer.mbed.org/teams/HIMBED_3AHELI/code/rtc_func/wiki/Klasse-Date-von-RTC8563-ableiten
 uint8_t Date::bcdToUint(uint8_t const nybbles)
 {
     uint8_t result;
@@ -25,9 +10,8 @@
 
 string Date::toString(uint8_t value)
 {
-    //return std::to_string(value); // ab C++ version 11
     char buffer[2];
-    sprintf (buffer, "%d", value);  // ToString()
+    sprintf (buffer, "%d", value);
     return buffer;
 }    
 
@@ -36,7 +20,6 @@
     uint8_t day = rtc_read(DAYS);
     return bcdToUint(day & 0x3F);
 }
-// ueberladene Methoden von GetDay
 uint8_t Date::GetDay(int value)   
 {
     return value;
diff -r 83be0e4edb52 -r 83c6939656e5 Date.h
--- a/Date.h	Thu Apr 23 10:44:24 2015 +0000
+++ b/Date.h	Thu Apr 30 10:54:02 2015 +0000
@@ -1,17 +1,3 @@
-/***********************************
-name:   date.h    Version: 0.5
-author: PE HTL BULME
-email:  pe@bulme.at
-description:
-    Real Time Clock (RTC8563) on HIMBED M0 - LPC11U24 
-    class Date inherited from class RTC8563
-    Example methode GetDay implemented 
-ToDo: 
-    implement GetYear, GetMonth;
-    Constructor to initialize Date on RTC
-    Alarm methode
-***********************************/
-
 #include "mbed.h"
 #include "const.h"
 #include "RTC8563.h"
@@ -19,18 +5,18 @@
 
 #ifndef DATE_H
 #define DATE_H
-class Date : public RTC8563 // Date abgeleitet von RTC8563
+class Date : public RTC8563
 {
 protected:
-    uint8_t bcdToUint(uint8_t const nybbles);   // private Methode
+    uint8_t bcdToUint(uint8_t const nybbles);
     string toString(uint8_t value);
 
 public:
-    Date()  // Standard Konstruktor
+    Date()
     {
     }   
-    uint8_t GetDay();   // Methode
-    uint8_t GetDay(int value);   // ueberladene Methode
-    string GetDay(string str);   // ueberladene Methode
+    uint8_t GetDay();
+    uint8_t GetDay(int value);
+    string GetDay(string str);
 };
 #endif
\ No newline at end of file
diff -r 83be0e4edb52 -r 83c6939656e5 DateString.cpp
--- a/DateString.cpp	Thu Apr 23 10:44:24 2015 +0000
+++ b/DateString.cpp	Thu Apr 30 10:54:02 2015 +0000
@@ -1,20 +1,11 @@
 #include "DateString.h"
 #include "RTC8563.h"
-// https://developer.mbed.org/teams/HIMBED_3AHELI/code/rtc_func/wiki/Klasse-DateString-von-Date-ableiten
-
-// 2. Methode ueberschreiben
 uint8_t DateString::GetDay()
 {
-    //uint8_t day = rtc_read(DAYS);
-    //return bcdToUint(day & 0x3F);
-    
-    uint8_t day = Date::GetDay();  // Aufruf der GetDay-Methode aus Basisklasse Date mit Scope-Operator
-    // 3. Erweitern von Methoden der Basisklasse
+    uint8_t day = Date::GetDay();
     day = day-5;
     return day;
 } 
-
-// 4. Definieren neuer Methoden 
 uint8_t DateString::GetNextDay()  
 {
     uint8_t day = GetDay();
diff -r 83be0e4edb52 -r 83c6939656e5 DateString.h
--- a/DateString.h	Thu Apr 23 10:44:24 2015 +0000
+++ b/DateString.h	Thu Apr 30 10:54:02 2015 +0000
@@ -1,6 +1,3 @@
-// DateString.h Version 0.5
-// https://developer.mbed.org/teams/HIMBED_3AHELI/code/rtc_func/wiki/Klasse-DateString-von-Date-ableiten
-
 #include "mbed.h"
 #include "const.h"
 #include "Date.h"
@@ -8,12 +5,12 @@
 
 #ifndef DATESTRING_H
 #define DATESTRING_H
-class DateString : public Date // DateString abgeleitet von Date
+class DateString : public Date
 {
 public:
-    uint8_t GetDay();       // 2. Methode ueberschreiben
+    uint8_t GetDay();
     
-    uint8_t GetNextDay(); // 4. Definieren neuer Methoden 
+    uint8_t GetNextDay();
     using Date::GetDay;
 };
 
diff -r 83be0e4edb52 -r 83c6939656e5 main.cpp
--- a/main.cpp	Thu Apr 23 10:44:24 2015 +0000
+++ b/main.cpp	Thu Apr 30 10:54:02 2015 +0000
@@ -1,15 +1,3 @@
-/***********************************
-name:   main.cpp    Version: 0.5
-author: PE HTL BULME
-email:  pe@bulme.at
-description:
-    Real Time Clock (RTC8563) 
-    on HIMBED M0 - LPC11U24 
-    class Date inherited from class RTC8563
-    Example methode GetDay implemented 
-ToDo: 
-    implement year, month;
-***********************************/
 #include "mbed.h"
 #include "const.h"
 #include "RTC8563.h"
@@ -23,7 +11,7 @@
 
 int main()
 {
-    DateString rtc;  // instanziieren des Objektes rtc
+    DateString rtc;
  
     while(1) {
         pc.printf("DateString.Day: %i\n", rtc.GetDay());