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:
Mon Jun 06 14:44:15 2016 +0000
Revision:
8:9eaa9772e1e7
Child:
12:db5110d9d494
Debugged SPI wrapper.

Who changed what in which revision?

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