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.

Committer:
aktk
Date:
Thu Jun 30 17:41:14 2016 +0000
Revision:
22:eaaaa42a0ccb
Parent:
19:ee2558b13570
The filename that SPT::TRP105FS::printCalibrationLOG() makes has become ADLOG%2d.TXT.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aktk 12:db5110d9d494 1 #ifndef TRP105F_SPLINE_SPI_WRAPPER_H
aktk 12:db5110d9d494 2 #define TRP105F_SPLINE_SPI_WRAPPER_H
aktk 8:9eaa9772e1e7 3
aktk 8:9eaa9772e1e7 4 #include "mbed.h"
aktk 8:9eaa9772e1e7 5 #include "TRP105F_Spline.h"
aktk 12:db5110d9d494 6 #include "CODE_SELECTIVE.h"
aktk 8:9eaa9772e1e7 7
aktk 8:9eaa9772e1e7 8 class SPI_TRP105FS
aktk 8:9eaa9772e1e7 9 {
aktk 8:9eaa9772e1e7 10 private:
aktk 8:9eaa9772e1e7 11 unsigned int channel; //SPI cs number
aktk 8:9eaa9772e1e7 12 unsigned int nsample; //number of sumples
aktk 8:9eaa9772e1e7 13 TRP105FS trp;
aktk 8:9eaa9772e1e7 14 char filename[13]; //name of file chalibration results saved
aktk 8:9eaa9772e1e7 15
aktk 8:9eaa9772e1e7 16 public:
aktk 8:9eaa9772e1e7 17 static SPI spi; // mosi(out), miso(in), sclk(clock)
aktk 8:9eaa9772e1e7 18 static DigitalOut cs; // cs (the chip select signal)
aktk 8:9eaa9772e1e7 19
aktk 8:9eaa9772e1e7 20 SPI_TRP105FS();
aktk 8:9eaa9772e1e7 21 SPI_TRP105FS(unsigned int arg_ch);
aktk 19:ee2558b13570 22 SPI_TRP105FS(unsigned int arg_ns, unsigned int arg_ch);
aktk 8:9eaa9772e1e7 23
aktk 8:9eaa9772e1e7 24 static int ADread(int channel);
aktk 8:9eaa9772e1e7 25
aktk 8:9eaa9772e1e7 26 void setSample(unsigned short arg_x);
aktk 8:9eaa9772e1e7 27
aktk 8:9eaa9772e1e7 28 void calibrate();
aktk 8:9eaa9772e1e7 29
aktk 8:9eaa9772e1e7 30 unsigned short getDistance();
aktk 8:9eaa9772e1e7 31
aktk 8:9eaa9772e1e7 32 unsigned int getChannel();
aktk 8:9eaa9772e1e7 33
aktk 8:9eaa9772e1e7 34 unsigned int getNsample();
aktk 8:9eaa9772e1e7 35
aktk 8:9eaa9772e1e7 36 void savedata();
aktk 8:9eaa9772e1e7 37
aktk 8:9eaa9772e1e7 38 void loaddata();
aktk 8:9eaa9772e1e7 39
aktk 8:9eaa9772e1e7 40 void printCalibrationiLOG();
aktk 8:9eaa9772e1e7 41 };
aktk 8:9eaa9772e1e7 42 #endif