aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.cpp')
-rw-r--r--src/utils.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utils.cpp b/src/utils.cpp
index f69b013..e7420bd 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -305,3 +305,15 @@ int absolute_to_dB(int16_t value)
return value ? round(20*log10((double)value / int16_max)) : -90;
}
+uint32_t read_u32_from_buf(const uint8_t *buf)
+{
+ return buf[0] * 256uL * 256uL * 256uL +
+ buf[1] * 256uL * 256uL +
+ buf[2] * 256uL +
+ buf[3];
+}
+
+uint16_t read_u16_from_buf(const uint8_t *buf)
+{
+ return buf[0] * 256uL + buf[1];
+}