From: Uwe Hermann Date: Sat, 28 May 2016 15:45:33 +0000 (+0200) Subject: hung-chang-dso-2100: Convert to SR_DF_ANALOG. X-Git-Tag: libsigrok-0.5.0~324 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=99f8fa25194aca21ec400353902e90eb425bd620;p=libsigrok.git hung-chang-dso-2100: Convert to SR_DF_ANALOG. --- diff --git a/src/hardware/hung-chang-dso-2100/protocol.c b/src/hardware/hung-chang-dso-2100/protocol.c index 31f161e8..88c47e0a 100644 --- a/src/hardware/hung-chang-dso-2100/protocol.c +++ b/src/hardware/hung-chang-dso-2100/protocol.c @@ -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); }