Corrected header file include guards (did not encapsulate entire header).

Fork of LocalFileSystem_Read by HEL's Angels

Revision:
1:a5555eb914bb
Child:
2:67fab81637b1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/localRead.cpp	Tue Jun 30 05:04:36 2015 +0000
@@ -0,0 +1,46 @@
+#include "mbed.h"
+#include "initExoVars.h"
+
+
+//Serial pc(USBTX, USBRX); // tx, rx
+DigitalOut myled(LED4);
+
+float     RightCalib;//=1.123456;  // gemeten waarde bij 4mA ( 0..1 <> 0..3.3v )
+float     LeftCalib;//=1.123;  // gemeten waarde bij 4mA ( 0..1 <> 0..3.3v )
+char A[10];//, B[10];
+
+//MAYBE PUT THIS IN INIT
+LocalFileSystem local("local");               // Create the local filesystem under the name "local"
+//float leftOff;
+
+
+
+void ReadFile (void)
+{
+    FILE *set = fopen("/local/calib.txt", "r");  // Open "setup.txt" on the local file system for read
+    fscanf(set,"%s %f",A,&LeftCalib); // read offset
+    fscanf(set,"%s %f",A,&RightCalib); // read offset
+    fclose(set);
+}
+/*
+void WriteFile(void)   // write to USB memory
+{
+    FILE *fp = fopen("/local/calib.txt", "w");  // Open "setup.txt" on the local file system for write
+    fprintf(fp,"LeftCalib %f\r\n",Left); // read offset
+    fprintf(fp,"RightCalib %f\r\n",Right); // read offset
+    //fprintf(fp,"gain %f\r\n",lOffset);   // read gain
+    fclose(fp);
+}*/
+
+void localRead()
+{
+    //char A[10];
+    myled=1;
+    __disable_irq();    // Disable Interrupts
+    wait(1);
+    ReadFile();// when you run first time without this line, the setup file is on created
+    wait(1);
+    pc.printf("Calibration settings loaded. \r\nLeft Offset is: %f, Right Offset is: %f\r\n", LeftCalib, RightCalib);
+    //pc.printf("%f\n roffset", roff);
+    __enable_irq();    // Disable Interrupts
+}