Trilateration Based Local Position System

Dependents:   TDP_main_BartFork TDP_main TDP_main TDP_main_fork

Revision:
3:dd68ac680416
Parent:
2:21ca29888540
diff -r 21ca29888540 -r dd68ac680416 LPS.h
--- a/LPS.h	Wed Mar 11 01:20:56 2015 +0000
+++ b/LPS.h	Thu Mar 12 22:12:18 2015 +0000
@@ -12,7 +12,7 @@
 class LPS {
     public:
         // Eventually use this to setup pin interconnects to Basestation
-        LPS();
+        LPS(PinName MOSI, PinName MISO, PinName SCLK);
         ~LPS();
     
         void calibratePosition(float iCal, float dCal, float jCal);
@@ -38,6 +38,12 @@
         float getd();
         float getj();
     private:
+        SPI _spi;
+        
+        // Bunch of storage locations for SPI transfers
+        int received_1;
+        int received_2;
+        int received_3;
         /*
          The three displacemnet values corrosponding to the calibration positions
             - ALL MOST BE Z=0
@@ -56,6 +62,7 @@
         */
         // i,d and j
         float i,d,j;
+        
         // Unit Vector
         _3D_Vector unitX, unitY, unitZ;
         
@@ -76,9 +83,10 @@
         _3D_Vector current_1;
         _3D_Vector current_2;
         
-        void updateCalDistances(bool isCalibrate);
         void updateDistances(); 
         
+        int fetchTimeOverSPI(int inst);
+        
         // Special function used for reading in and storing all 9 distances needed for calibration, abuse _3D_Vector to optimise memory
         void updateCalibrationDistances();