]> sigrok.org Git - libsigrok.git/commitdiff
korad-kaxxxxp: Convert to SR_DF_ANALOG.
authorUwe Hermann <redacted>
Sat, 14 May 2016 15:06:54 +0000 (17:06 +0200)
committerUwe Hermann <redacted>
Thu, 16 Jun 2016 13:05:01 +0000 (15:05 +0200)
src/hardware/korad-kaxxxxp/protocol.c

index 5151e1fa251b6b1a1b27e6b7f92eee03084f1a02..04800257e3e131ce9bb54735b4a7d90f936989d3 100644 (file)
@@ -328,7 +328,10 @@ SR_PRIV int korad_kaxxxxp_receive_data(int fd, int revents, void *cb_data)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
        struct sr_datafeed_packet packet;
-       struct sr_datafeed_analog_old analog;
+       struct sr_datafeed_analog analog;
+       struct sr_analog_encoding encoding;
+       struct sr_analog_meaning meaning;
+       struct sr_analog_spec spec;
        uint64_t elapsed_us;
 
        (void)fd;
@@ -345,22 +348,24 @@ SR_PRIV int korad_kaxxxxp_receive_data(int fd, int revents, void *cb_data)
                /* Get the value. */
                korad_kaxxxxp_get_reply(serial, devc);
 
+               sr_analog_init(&analog, &encoding, &meaning, &spec, 0);
+
                /* Send the value forward. */
-               packet.type = SR_DF_ANALOG_OLD;
+               packet.type = SR_DF_ANALOG;
                packet.payload = &analog;
-               analog.channels = sdi->channels;
+               analog.meaning->channels = sdi->channels;
                analog.num_samples = 1;
                if (devc->target == KAXXXXP_CURRENT) {
-                       analog.mq = SR_MQ_CURRENT;
-                       analog.unit = SR_UNIT_AMPERE;
-                       analog.mqflags = 0;
+                       analog.meaning->mq = SR_MQ_CURRENT;
+                       analog.meaning->unit = SR_UNIT_AMPERE;
+                       analog.meaning->mqflags = 0;
                        analog.data = &devc->current;
                        sr_session_send(sdi, &packet);
                }
                if (devc->target == KAXXXXP_VOLTAGE) {
-                       analog.mq = SR_MQ_VOLTAGE;
-                       analog.unit = SR_UNIT_VOLT;
-                       analog.mqflags = SR_MQFLAG_DC;
+                       analog.meaning->mq = SR_MQ_VOLTAGE;
+                       analog.meaning->unit = SR_UNIT_VOLT;
+                       analog.meaning->mqflags = SR_MQFLAG_DC;
                        analog.data = &devc->voltage;
                        sr_session_send(sdi, &packet);
                        sr_sw_limits_update_samples_read(&devc->limits, 1);