diff options
author | Ta180m | 2020-02-21 16:35:26 -0600 |
---|---|---|
committer | Ta180m | 2020-02-21 16:35:26 -0600 |
commit | fbaeb54b60cb106a79dd6eb0a961987313419d03 (patch) | |
tree | 6c604ef3294ce33479974e9a872f5e5a048615b7 /libraries | |
parent | ec2fd8038bc08cd784e169a151fd81ed3b184764 (diff) |
New calibration method
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/detectorBuilding/detectorBuilding.cpp | 3 | ||||
-rw-r--r-- | libraries/detectorBuilding/detectorBuilding.h | 2 | ||||
-rw-r--r-- | libraries/detectorBuilding/keywords.txt | 1 |
3 files changed, 6 insertions, 0 deletions
diff --git a/libraries/detectorBuilding/detectorBuilding.cpp b/libraries/detectorBuilding/detectorBuilding.cpp index 8c38009..6a06bae 100644 --- a/libraries/detectorBuilding/detectorBuilding.cpp +++ b/libraries/detectorBuilding/detectorBuilding.cpp @@ -22,6 +22,9 @@ inline double k2f(double k) { return c2f(k2c(k)); } // Kelvin to Fahrenheit inline double a2d(int a) { return V_in * a / analog_max; } inline int d2a(double d) { return d * analog_max / V_in; } +// Voltage to resistance conversion +inline double v2r(double V_out) { return R_k * (V_in / V_out - 1); } + // Utility functions // No C++ standard library :( void sort(double a[], int n) { diff --git a/libraries/detectorBuilding/detectorBuilding.h b/libraries/detectorBuilding/detectorBuilding.h index b9cf4ee..668048c 100644 --- a/libraries/detectorBuilding/detectorBuilding.h +++ b/libraries/detectorBuilding/detectorBuilding.h @@ -19,6 +19,8 @@ inline double k2f(double k); inline double a2d(int a); inline int d2a(double d); +inline double v2r(double V_out); + void sort(double a[], int n); void calculate(); diff --git a/libraries/detectorBuilding/keywords.txt b/libraries/detectorBuilding/keywords.txt index 4c7390c..ee7800a 100644 --- a/libraries/detectorBuilding/keywords.txt +++ b/libraries/detectorBuilding/keywords.txt @@ -6,5 +6,6 @@ f2k KEYWORD2 k2f KEYWORD2 a2d KEYWORD2 d2a KEYWORD2 +v2r KEYWORD2 sort KEYWORD2 calculate KEYWORD2
\ No newline at end of file |