From: Uwe Hermann Date: Sat, 14 May 2016 15:10:34 +0000 (+0200) Subject: kern-scale: Convert to SR_DF_ANALOG. X-Git-Tag: libsigrok-0.5.0~341 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=563ba4a5c22475357604bffd1e391a4c53c55e50;p=libsigrok.git kern-scale: Convert to SR_DF_ANALOG. --- diff --git a/src/hardware/kern-scale/protocol.c b/src/hardware/kern-scale/protocol.c index 0af2adde..01838e3d 100644 --- a/src/hardware/kern-scale/protocol.c +++ b/src/hardware/kern-scale/protocol.c @@ -33,25 +33,28 @@ static void handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi, struct scale_info *scale; float floatval; 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; struct dev_context *devc; scale = (struct scale_info *)sdi->driver; devc = sdi->priv; - memset(&analog, 0, sizeof(struct sr_datafeed_analog_old)); + sr_analog_init(&analog, &encoding, &meaning, &spec, 0); - analog.channels = sdi->channels; + analog.meaning->channels = sdi->channels; analog.num_samples = 1; - analog.mq = -1; + analog.meaning->mq = 0; scale->packet_parse(buf, &floatval, &analog, info); analog.data = &floatval; - if (analog.mq != -1) { + if (analog.meaning->mq != 0) { /* Got a measurement. */ - packet.type = SR_DF_ANALOG_OLD; + packet.type = SR_DF_ANALOG; packet.payload = &analog; sr_session_send(sdi, &packet); sr_sw_limits_update_samples_read(&devc->limits, 1); diff --git a/src/hardware/kern-scale/protocol.h b/src/hardware/kern-scale/protocol.h index dcfe06cb..ba4942ad 100644 --- a/src/hardware/kern-scale/protocol.h +++ b/src/hardware/kern-scale/protocol.h @@ -40,7 +40,7 @@ struct scale_info { gboolean (*packet_valid)(const uint8_t *); /** Packet parsing function. */ int (*packet_parse)(const uint8_t *, float *, - struct sr_datafeed_analog_old *, void *); + struct sr_datafeed_analog *, void *); /** Size of chipset info struct. */ gsize info_size; }; diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 08c9b788..a98ef995 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -1327,7 +1327,7 @@ struct kern_info { SR_PRIV gboolean sr_kern_packet_valid(const uint8_t *buf); SR_PRIV int sr_kern_parse(const uint8_t *buf, float *floatval, - struct sr_datafeed_analog_old *analog, void *info); + struct sr_datafeed_analog *analog, void *info); /*--- sw_limits.c -----------------------------------------------------------*/