Code to interface with the MCP7940 Real time clock. Supports getting and setting the time in 24 hour format

Files at this revision

API Documentation at this revision

Comitter:
MichaelW
Date:
Fri Jun 19 15:33:03 2015 +0000
Child:
1:8f330348d96b
Commit message:
InitialCommit;

Changed in this revision

MCP7490.cpp Show annotated file Show diff for this revision Revisions of this file
MCP7490.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MCP7490.cpp	Fri Jun 19 15:33:03 2015 +0000
@@ -0,0 +1,43 @@
+#include "MCP7490.h"
+
+    MCP7490::MCP7490(PinName sda, PinName scl){
+        
+        }
+MCP7490::MCP7490(){
+    
+    }
+
+    int MCP7490::getTime(){
+        _Day = 1;
+        _Month = 1;
+        _Year = 2015;
+        _Hour = 0;
+        _Minutes = 1;
+        _Seconds = 1;
+        _MilliSeconds = 0;
+        return(0);
+    }
+
+    int MCP7490::Day(){
+        return(_Day);
+        }
+    int MCP7490::Month(){
+        return(_Month);
+        }
+    int MCP7490::Year(){
+        return(_Year);
+        }
+    int MCP7490::Hour(){
+        return(_Hour);
+        }
+        
+    int MCP7490::Minutes(){
+        return(_Minutes);
+        
+        }
+    int MCP7490::Seconds(){
+        return(_Seconds);
+        }
+        int MCP7490::MilliSeconds(){
+            return(_MilliSeconds);
+            }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MCP7490.h	Fri Jun 19 15:33:03 2015 +0000
@@ -0,0 +1,35 @@
+#ifndef __MCP7490_H__
+#define __MCP7490_H__
+
+#include "mbed.h"
+
+class MCP7490{
+public:
+MCP7490(PinName sda, PinName scl);
+MCP7490();
+
+    int getTime();
+
+    int Day();
+    int Month();
+    int Year();
+    int Hour();
+    int Minutes();
+    int Seconds();
+    int MilliSeconds();
+    
+    
+    private:
+    int _Day;
+    int _Month;
+    int _Year;
+    int _Hour;
+    int _Minutes;
+    int _Seconds;  
+    int _MilliSeconds;
+    
+    
+};
+
+
+#endif
\ No newline at end of file