Penn Electric Racing / Mbed 2 deprecated SystemManagement

Dependencies:   mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP

Fork of SystemManagement by Martin Deng

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RTCStore.h Source File

RTCStore.h

00001 /*  Test Code
00002     #include "Battery_Status.h"
00003     #include"mbed.h"   
00004     BatteryStatus battery;
00005     
00006     int main()
00007     {
00008         //battery.write(6.92,0);
00009         printf("LPC_RTC->GPREG0:%f\n\r",battery.read(0));
00010         //battery.write(7.92,1);
00011         printf("LPC_RTC->GPREG1:%f\n\r",battery.read(1));
00012         //battery.write(8.92,2);
00013         printf("LPC_RTC->GPREG2:%f\n\r",battery.read(2));
00014         //battery.write(9.92,3);
00015         printf("LPC_RTC->GPREG3:%f\n\r",battery.read(3));
00016         //battery.write(10.92,4);
00017         printf("LPC_RTC->GPREG4:%f\n\r",battery.read(4));
00018     }
00019 */
00020 
00021 #ifndef _RTC_STORE_H
00022 #define _RTC_STORE_H
00023 #include "mbed.h"
00024 
00025 class RTCStore {
00026 public:
00027     RTCStore() {
00028         LPC_SC->PCONP |= (1<<9);        // Enable RTC Peripheral
00029     }
00030     void write(float data, int block) {
00031         *((float*)(&LPC_RTC->GPREG0)+block) = data;
00032     }
00033     float read(int block) {
00034         return *((float*)(&LPC_RTC->GPREG0)+block);
00035     }
00036 };
00037 #endif
00038