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.
TRP105FS_SPIWrapper.h@7:f2e139f8bd68, 2016-06-06 (annotated)
- Committer:
- aktk
- Date:
- Mon Jun 06 13:23:49 2016 +0000
- Revision:
- 7:f2e139f8bd68
file divided into TPR105FS_SPIWrapper.h,.c;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aktk | 7:f2e139f8bd68 | 1 | #ifndef TRP105F_SPLINE_SPI_WRAPPER |
aktk | 7:f2e139f8bd68 | 2 | #define TRP105F_SPLINE_SPI_WRAPPER |
aktk | 7:f2e139f8bd68 | 3 | |
aktk | 7:f2e139f8bd68 | 4 | #include "mbed.h" |
aktk | 7:f2e139f8bd68 | 5 | |
aktk | 7:f2e139f8bd68 | 6 | class SPI_TRP105FS |
aktk | 7:f2e139f8bd68 | 7 | { |
aktk | 7:f2e139f8bd68 | 8 | private: |
aktk | 7:f2e139f8bd68 | 9 | unsigned int channel; //SPI cs number |
aktk | 7:f2e139f8bd68 | 10 | unsigned int nsample; //number of sumples |
aktk | 7:f2e139f8bd68 | 11 | TRP105FS trp; |
aktk | 7:f2e139f8bd68 | 12 | char filename[13]; //name of file chalibration results saved |
aktk | 7:f2e139f8bd68 | 13 | |
aktk | 7:f2e139f8bd68 | 14 | public: |
aktk | 7:f2e139f8bd68 | 15 | SPI_TRP105FS(); |
aktk | 7:f2e139f8bd68 | 16 | SPI_TRP105FS(unsigned int arg_ch); |
aktk | 7:f2e139f8bd68 | 17 | |
aktk | 7:f2e139f8bd68 | 18 | void setSample(unsigned short arg_x); |
aktk | 7:f2e139f8bd68 | 19 | |
aktk | 7:f2e139f8bd68 | 20 | void calibrate(); |
aktk | 7:f2e139f8bd68 | 21 | |
aktk | 7:f2e139f8bd68 | 22 | unsigned short getDistance(); |
aktk | 7:f2e139f8bd68 | 23 | |
aktk | 7:f2e139f8bd68 | 24 | unsigned int getChannel(); |
aktk | 7:f2e139f8bd68 | 25 | |
aktk | 7:f2e139f8bd68 | 26 | unsigned int getNsample(); |
aktk | 7:f2e139f8bd68 | 27 | |
aktk | 7:f2e139f8bd68 | 28 | void savedata(); |
aktk | 7:f2e139f8bd68 | 29 | |
aktk | 7:f2e139f8bd68 | 30 | void loaddata(); |
aktk | 7:f2e139f8bd68 | 31 | |
aktk | 7:f2e139f8bd68 | 32 | void printCalibrationiLOG(); |
aktk | 7:f2e139f8bd68 | 33 | }; |
aktk | 7:f2e139f8bd68 | 34 | #endif |