]> sigrok.org Git - libsigrok.git/commitdiff
hung-chang-dso-2100: Convert to SR_DF_ANALOG.
authorUwe Hermann <redacted>
Sat, 28 May 2016 15:45:33 +0000 (17:45 +0200)
committerUwe Hermann <redacted>
Fri, 17 Jun 2016 13:13:10 +0000 (15:13 +0200)
src/hardware/hung-chang-dso-2100/protocol.c

index 31f161e8f1dca4f03ec5cbab4acf242f6ddf24a2..88c47e0ae811a938101570af66774eef18fe66df 100644 (file)
@@ -331,16 +331,12 @@ static void push_samples(const struct sr_dev_inst *sdi, uint8_t *buf, size_t num
 {
        struct dev_context *devc = sdi->priv;
        float *data = devc->samples;
-       struct sr_datafeed_analog_old analog = {
-               .channels = devc->enabled_channel,
-               .num_samples = num,
-               .mq = SR_MQ_VOLTAGE,
-               .unit = SR_UNIT_VOLT,
-               .mqflags = 0,
-               .data = data,
-       };
+       struct sr_datafeed_analog analog;
+       struct sr_analog_encoding encoding;
+       struct sr_analog_meaning meaning;
+       struct sr_analog_spec spec;
        struct sr_datafeed_packet packet = {
-               .type = SR_DF_ANALOG_OLD,
+               .type = SR_DF_ANALOG,
                .payload = &analog,
        };
        float factor = devc->factor;
@@ -348,6 +344,14 @@ static void push_samples(const struct sr_dev_inst *sdi, uint8_t *buf, size_t num
        while (num--)
                data[num] = (buf[num] - 0x80) * factor;
 
+       sr_analog_init(&analog, &encoding, &meaning, &spec, 0);
+       analog.meaning->channels = devc->enabled_channel;
+       analog.meaning->mq = SR_MQ_VOLTAGE;
+       analog.meaning->unit = SR_UNIT_VOLT;
+       analog.meaning->mqflags = 0;
+       analog.num_samples = num;
+       analog.data = data;
+
        sr_session_send(sdi, &packet);
 }