aboutsummaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-10-30 20:33:41 +0100
committerlonkaars <loek@pipeframe.xyz>2022-10-30 20:33:41 +0100
commitea9463c3ba9335bc3d04dd04502ab9e67e8a718c (patch)
treede55f4b03eba50533f6dd220c31d50fa4239d94a /shared
parentc0eeae6901572be2469ab61620c39cd2d3b2cb58 (diff)
finish merge
Diffstat (limited to 'shared')
-rw-r--r--shared/shared.mk1
-rw-r--r--shared/util.c9
-rw-r--r--shared/util.h9
3 files changed, 18 insertions, 1 deletions
diff --git a/shared/shared.mk b/shared/shared.mk
deleted file mode 100644
index f9586ff..0000000
--- a/shared/shared.mk
+++ /dev/null
@@ -1 +0,0 @@
-OBJS += $(patsubst %.c,%-stm.o, $(wildcard ../shared/*.c))
diff --git a/shared/util.c b/shared/util.c
index 648631a..94f2273 100644
--- a/shared/util.c
+++ b/shared/util.c
@@ -6,6 +6,10 @@ unsigned int ws_log16(unsigned int x) {
return l;
}
+#ifdef __cplusplus
+extern "C" {
+#endif
+
uint8_t ws_sensor_tmp_to_8(uint16_t temperature) {
return temperature / 256;
}
@@ -29,3 +33,8 @@ float ws_sensor_hum_to_f(uint8_t humidity) {
float ws_sensor_atm_to_f(uint8_t atmospheric_pressure) {
return ((20.0 * atmospheric_pressure) / 256.0) + 990.0; // datasheet no?
}
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/shared/util.h b/shared/util.h
index 1bee487..8cb54c1 100644
--- a/shared/util.h
+++ b/shared/util.h
@@ -8,6 +8,10 @@
/** @brief take the log base 16 of `x` */
unsigned int ws_log16(unsigned int x);
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/** @brief convert 16-bit temperature value to uint8_t */
uint8_t ws_sensor_tmp_to_8(uint16_t temperature);
/** @brief convert 16-bit humidity value to uint8_t */
@@ -21,3 +25,8 @@ float ws_sensor_tmp_to_f(uint8_t temperature);
float ws_sensor_hum_to_f(uint8_t humidity);
/** @brief convert 8-bit atmospheric pressure value back to float */
float ws_sensor_atm_to_f(uint8_t atmospheric_pressure);
+
+#ifdef __cplusplus
+}
+#endif
+