]> sigrok.org Git - libsigrok.git/blobdiff - src/binary_helpers.c
binary_helpers: Reflect that bv_get_value() takes bytes as input
[libsigrok.git] / src / binary_helpers.c
index e1c00dddc47162be18415c2b1594cac63b7daa01..e8547a01103686260714fc6094f41d64c8a3a57d 100644 (file)
@@ -23,7 +23,7 @@
 #include "libsigrok-internal.h"
 
 SR_PRIV int bv_get_value(float *out, const struct binary_value_spec *spec,
-       const void *data, size_t length)
+       const uint8_t *data, size_t length)
 {
        float value;
 
@@ -41,11 +41,13 @@ SR_PRIV int bv_get_value(float *out, const struct binary_value_spec *spec,
        VALUE_TYPE(BVT_UINT8, read_u8, sizeof(uint8_t));
 
        VALUE_TYPE(BVT_BE_UINT16, read_u16be, sizeof(uint16_t));
+       VALUE_TYPE(BVT_BE_UINT24, read_u24be, 3 * sizeof(uint8_t));
        VALUE_TYPE(BVT_BE_UINT32, read_u32be, sizeof(uint32_t));
        VALUE_TYPE(BVT_BE_UINT64, read_u64be, sizeof(uint64_t));
        VALUE_TYPE(BVT_BE_FLOAT,  read_fltbe, sizeof(float));
 
        VALUE_TYPE(BVT_LE_UINT16, read_u16le, sizeof(uint16_t));
+       VALUE_TYPE(BVT_LE_UINT24, read_u24le, 3 * sizeof(uint8_t));
        VALUE_TYPE(BVT_LE_UINT32, read_u32le, sizeof(uint32_t));
        VALUE_TYPE(BVT_LE_UINT64, read_u64le, sizeof(uint64_t));
        VALUE_TYPE(BVT_LE_FLOAT,  read_fltle, sizeof(float));
@@ -56,8 +58,6 @@ SR_PRIV int bv_get_value(float *out, const struct binary_value_spec *spec,
 
 #undef VALUE_TYPE
 
-       if (spec->scale)
-               value *= spec->scale;
        if (out)
                *out = value;
        return SR_OK;