aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/units.h
diff options
context:
space:
mode:
authorGravatar Tim Segers <tsegers@pm.me>2023-08-08 20:48:27 +0200
committerGravatar Tim Segers <tsegers@pm.me>2023-08-21 20:54:41 +0200
commitb4582977251dbf07c13c4d69a4f7be04e75612d6 (patch)
tree5d49111f98766bf06302b4dea851d580ae78d319 /src/units.h
parentc46ebe4b35e3a0ffebf00b0eaa31b842279396b6 (diff)
downloadopendeco-develop.tar.gz
Split unit conversion functions out from deco.cdevelop
Diffstat (limited to 'src/units.h')
-rw-r--r--src/units.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/units.h b/src/units.h
new file mode 100644
index 0000000..1557bc0
--- /dev/null
+++ b/src/units.h
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: MIT-0 */
+
+#ifndef UNITS_H
+#define UNITS_H
+
+#define UNITS_DEFAULT METRIC
+#define SURFACE_PRESSURE_DEFAULT 1.01325
+
+/* types */
+enum UNITS {
+ METRIC,
+ IMPERIAL,
+};
+
+/* global variables */
+extern enum UNITS UNITS;
+extern double SURFACE_PRESSURE;
+
+/* functions */
+double bar_to_msw(double bar);
+double msw_to_bar(double msw);
+double bar_to_fsw(double bar);
+double fsw_to_bar(double msw);
+double msw_or_fsw(double msw, double fsw);
+double xsw_to_bar(double xsw);
+double bar_to_xsw(double bar);
+double abs_depth(double gd);
+double gauge_depth(double ad);
+
+#endif /* end of include guard: UNITS_H */