This lib is supposed to be used as a sensor's calibration or control program. This makes Cubic Spline Model from some sample plots(sets of (value, voltage)), and then discretize the model (dividing the range of voltage into some steps) in order to use the calibrated model data without getting the INVERSE function.

Revision:
11:d60fb729eacf
Parent:
10:b50e4bb40571
Child:
12:db5110d9d494
--- a/TRP105F_Spline.cpp	Mon Jun 06 15:41:44 2016 +0000
+++ b/TRP105F_Spline.cpp	Mon Jun 06 19:49:20 2016 +0000
@@ -1,14 +1,26 @@
-#define DEBUG
-//#define DEBUG2
 #include "TRP105F_Spline.h"
 
+//
+//  For Platform Variation
+//
+#if defined(TARGET_LPC1114)
+const PinName DEFALT_AI_PIN = dp4;
+#elif defined (TARGET_LPC1768)
+const PinName DEFALT_AI_PIN = p16;
+LocalFileSystem local("local");  // define Mount Point(which becomes Direcory Path)
+//  To get sample distance via seral com
+Serial      g_Serial_Signal(USBTX, USBRX);
 //  To get ytage of TRP105F
 //AnalogIn*   g_Sensor_Voltage;
-//  To get sample distance via seral com
-Serial      g_Serial_Signal(USBTX, USBRX);
+#endif
+
+
 
-LocalFileSystem local("local");  // define Mount Point(which becomes Direcory Path)
-// for debug
+//
+//  For debug
+//
+//#define DEBUG
+//#define DEBUG2
 #ifdef DEBUG
 DigitalOut led1(LED1);
 DigitalOut led2(LED2);
@@ -258,6 +270,9 @@
             tmp++;
     }
 }
+
+
+#ifdef TARGET_LPC1768
 void TRP105FS::_sampleData()
 {
     int     tmp;
@@ -358,6 +373,7 @@
             tmp++;
     }
 }
+#endif
 
 //
 //  Function to define _u_spline, specific constants of spline.
@@ -509,6 +525,7 @@
     return ((unsigned short)(int)y);
 }
 
+#if defined(HAS_COM_TO_CONSOLE)
 void TRP105FS::calibrateSensor()
 {
     _sampleData();
@@ -523,6 +540,7 @@
 #endif
     }
 }
+#endif
 
 void TRP105FS::calibrate()
 {
@@ -571,11 +589,14 @@
 
 }
 
+#ifdef TARGET_LPC1768
 void TRP105FS::printThresholds()
 {
     for(int i = 0; i < _ENUM; i++)
         g_Serial_Signal.printf("Threshold[%d]%d\n",i,_Threshold[i]);
 }
+#endif
+
 void TRP105FS::loadSetting()
 {
     FILE *fp;