Penn Electric Racing / Mbed 2 deprecated SystemManagement

Dependencies:   mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP

Fork of SystemManagement by Martin Deng

Revision:
13:fbd9b3f5a07c
Child:
17:c9ce210f6654
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CoulombCounter/RTCStore.h	Fri Oct 24 22:09:04 2014 +0000
@@ -0,0 +1,38 @@
+/*  Test Code
+    #include "Battery_Status.h"
+    #include"mbed.h"   
+    BatteryStatus battery;
+    
+    int main()
+    {
+        //battery.write(6.92,0);
+        printf("LPC_RTC->GPREG0:%f\n\r",battery.read(0));
+        //battery.write(7.92,1);
+        printf("LPC_RTC->GPREG1:%f\n\r",battery.read(1));
+        //battery.write(8.92,2);
+        printf("LPC_RTC->GPREG2:%f\n\r",battery.read(2));
+        //battery.write(9.92,3);
+        printf("LPC_RTC->GPREG3:%f\n\r",battery.read(3));
+        //battery.write(10.92,4);
+        printf("LPC_RTC->GPREG4:%f\n\r",battery.read(4));
+    }
+*/        
+
+#ifndef _RTC_STORE_H
+#define _RTC_STORE_H
+#include "mbed.h"
+
+class RTCStore {
+public:
+    RTCStore() {
+        LPC_SC->PCONP |= (1<<9);        // Enable RTC Peripheral
+    }
+    void write(float data, int block) {
+        *((float*)(&LPC_RTC->GPREG0)+sizeof(float)*block) = data;
+    }
+    float read(int block) {
+        return *((float*)((&LPC_RTC->GPREG0)+sizeof(float)*block));
+    }              
+};
+#endif
+    
\ No newline at end of file