aboutsummaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorTa180m2020-02-21 21:36:47 -0600
committerTa180m2020-02-21 21:36:47 -0600
commit92e93933c29a4071c11a2a1b831951e1dbe5458b (patch)
treef2e4da494cb82e0bb148fa233a48074d312b4bb1 /libraries
parentb0141d3f681c0edc04253c70c13863772b20cc4a (diff)
Fixed libraries
Diffstat (limited to 'libraries')
-rw-r--r--libraries/detectorBuilding/keywords.txt3
-rw-r--r--libraries/detectorBuilding/library.properties10
-rw-r--r--libraries/detectorBuilding/src/detectorBuilding.cpp (renamed from libraries/detectorBuilding/detectorBuilding.cpp)11
-rw-r--r--libraries/detectorBuilding/src/detectorBuilding.h (renamed from libraries/detectorBuilding/detectorBuilding.h)5
4 files changed, 22 insertions, 7 deletions
diff --git a/libraries/detectorBuilding/keywords.txt b/libraries/detectorBuilding/keywords.txt
index ee7800a..894f3c0 100644
--- a/libraries/detectorBuilding/keywords.txt
+++ b/libraries/detectorBuilding/keywords.txt
@@ -7,5 +7,4 @@ k2f KEYWORD2
a2d KEYWORD2
d2a KEYWORD2
v2r KEYWORD2
-sort KEYWORD2
-calculate KEYWORD2 \ No newline at end of file
+sort KEYWORD2 \ No newline at end of file
diff --git a/libraries/detectorBuilding/library.properties b/libraries/detectorBuilding/library.properties
new file mode 100644
index 0000000..5b7c9af
--- /dev/null
+++ b/libraries/detectorBuilding/library.properties
@@ -0,0 +1,10 @@
+name=DetectorBuilding
+version=1.0
+author=unixkcd <unixkcd@gmail.com>
+maintainer=unixkcd <unixkcd@gmail.com>
+sentence=Detector building utility code
+paragraph=Some detector building utility code
+url=https://github.com/Ta180m/Detector-Building
+includes=detectorBuilding.h
+category=Data Processing
+architectures=*
diff --git a/libraries/detectorBuilding/detectorBuilding.cpp b/libraries/detectorBuilding/src/detectorBuilding.cpp
index 6a06bae..3bca44c 100644
--- a/libraries/detectorBuilding/detectorBuilding.cpp
+++ b/libraries/detectorBuilding/src/detectorBuilding.cpp
@@ -4,11 +4,10 @@
Released into the public domain.
*/
+
#include "Arduino.h"
#include "detectorBuilding.h"
-const int LED_R = 4, LED_G = 3, LED_B = 2, THERM = 0; // Device component pins
-const double R_k = 10000, V_in = 5, analog_max = 1023; // Device constants
// Temperature conversions
inline double f2c(double f) { return (f - 32) * 5 / 9; } // Fahrenheit to Celsius
@@ -18,13 +17,16 @@ inline double c2k(double c) { return c + 273.15; } // Celsius to Kelvin
inline double f2k(double f) { return c2k(f2c(f)); } // Fahrenheit to Kelvin
inline double k2f(double k) { return c2f(k2c(k)); } // Kelvin to Fahrenheit
+
// Analog to digital conversion
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) {
@@ -42,9 +44,10 @@ void sort(double a[], int n) {
}
}
+
// Calculations: Steinhart-hart stuff
// Probably unused but can include anyways
-void calculate() {
+/*void calculate() {
sort(V, n);
sort(T, n);
double R[n], L[n], Y[n], G[n];
@@ -61,4 +64,4 @@ void calculate() {
A[i / 3] = Y[i] - L[i] * (B[i / 3] + L[i] * L[i] * C[i / 3]);
}
for (int i = 0; i < n; i += 3) V_mid[i / 3] = (i ? (V[i - 1] + V[i]) / 2 : V[i]);
-} \ No newline at end of file
+}*/ \ No newline at end of file
diff --git a/libraries/detectorBuilding/detectorBuilding.h b/libraries/detectorBuilding/src/detectorBuilding.h
index 668048c..b82cc35 100644
--- a/libraries/detectorBuilding/detectorBuilding.h
+++ b/libraries/detectorBuilding/src/detectorBuilding.h
@@ -9,6 +9,9 @@
#include "Arduino.h"
+const int LED_R = 4, LED_G = 3, LED_B = 2, THERM = 0; // Device component pins
+const double R_k = 10000, V_in = 5, analog_max = 1023; // Device constants
+
inline double f2c(double f);
inline double c2f(double c);
inline double k2c(double k);
@@ -23,6 +26,6 @@ inline double v2r(double V_out);
void sort(double a[], int n);
-void calculate();
+//void calculate();
#endif \ No newline at end of file