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:
16:c2b0f3ca63dd
Parent:
14:a99bf22b919d
Child:
17:f6ec7796dafd
--- a/TRP105F_Spline.h	Wed Jun 08 10:45:19 2016 +0000
+++ b/TRP105F_Spline.h	Wed Jun 08 11:32:29 2016 +0000
@@ -61,9 +61,10 @@
     ~TRP105FS();
     //  Functions
     unsigned short getDistance(unsigned short); // alias of getX
-    unsigned short getDistance(); // get voltage from PinName and getX()
-    unsigned short getX(unsigned short);  //  the fuction to get distance.
-    unsigned short getY(unsigned short);
+    unsigned short getDistance();   // get voltage from PinName and getX()
+    unsigned short getVoltage();    // get voltage
+    unsigned short getX(unsigned short);    //  the fuction to get distance.
+    unsigned short getY(unsigned short);    //  get y-spline_model value of x(argument)
     unsigned short getSampleNum();
     void    calibrateSensor();
     //void    calibrateSensor(VDset* arg_set, unsigned int arg_num);
@@ -131,4 +132,22 @@
     void    _printOutData(double            *arg, int num, char* name);
 #endif
 };
+
+//inline implemeted
+
+inline unsigned short TRP105FS::getDistance(unsigned short arg_y)
+{
+    return getX(arg_y);
+}
+
+inline unsigned short TRP105FS::getDistance()
+{
+    return getX(_ai.read_u16());
+}
+
+inline unsigned short TRP105FS::getVoltage()
+{
+    return _ai.read_u16();
+}
+
 #endif
\ No newline at end of file