Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP
Fork of SystemManagement by
Diff: RTCStore/Store_RTC.h
- Revision:
- 0:e516fcccccda
- Child:
- 1:e02eb179aed3
diff -r 000000000000 -r e516fcccccda RTCStore/Store_RTC.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/RTCStore/Store_RTC.h Wed Oct 01 12:52:26 2014 +0000
@@ -0,0 +1,50 @@
+/* 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 _BATTERY_STATUS_
+#define _BATTERY_STATUS_
+#include"mbed.h"
+
+#define _GPREG_BASE 0x40024044
+
+// RTC = Real-Time Clock
+
+class RTCStore
+{
+ public:
+ RTCStore()
+ {
+ LPC_SC->PCONP |= (1<<9); //Enable RTC Peripheral
+ }
+
+ void write(float data, int block)
+ {
+ *(uint32_t*)(_GPREG_BASE + (0x04*block)) = *((uint32_t*)&data);
+ //LPC_RTC->GPREG0 = *((uint32_t*)&data);
+ }
+
+ float read(int block)
+ {
+ return *((float*)(uint32_t*)(_GPREG_BASE + (0x04*block)));
+ //return *((float*)&(LPC_RTC->GPREG0));
+ }
+};
+#endif /* _BATTERY_STATUS_ */
+
\ No newline at end of file
