From: Uwe Hermann Date: Sat, 28 May 2016 15:46:06 +0000 (+0200) Subject: motech-lps-30x: Convert to SR_DF_ANALOG. X-Git-Tag: libsigrok-0.5.0~321 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=ddfe99d92f70a8a26cb3aa809e59c6a242897bd3;p=libsigrok.git motech-lps-30x: Convert to SR_DF_ANALOG. --- diff --git a/src/hardware/motech-lps-30x/protocol.c b/src/hardware/motech-lps-30x/protocol.c index 1a3c75dc..80b799d9 100644 --- a/src/hardware/motech-lps-30x/protocol.c +++ b/src/hardware/motech-lps-30x/protocol.c @@ -33,30 +33,36 @@ static void send_data(struct sr_dev_inst *sdi) { struct dev_context *devc; 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; int i; float data[MAX_CHANNELS]; devc = sdi->priv; - packet.type = SR_DF_ANALOG_OLD; + packet.type = SR_DF_ANALOG; packet.payload = &analog; - analog.channels = sdi->channels; - analog.num_samples = 1; - analog.mq = SR_MQ_VOLTAGE; - analog.unit = SR_UNIT_VOLT; - analog.mqflags = SR_MQFLAG_DC; + sr_analog_init(&analog, &encoding, &meaning, &spec, 0); + + analog.meaning->channels = sdi->channels; + analog.num_samples = 1; + analog.meaning->mq = SR_MQ_VOLTAGE; + analog.meaning->unit = SR_UNIT_VOLT; + analog.meaning->mqflags = SR_MQFLAG_DC; analog.data = data; + for (i = 0; i < devc->model->num_channels; i++) - analog.data[i] = devc->channel_status[i].output_voltage_last; /* Value always 3.3 or 5 for channel 3, if present! */ + ((float *)analog.data)[i] = devc->channel_status[i].output_voltage_last; /* Value always 3.3 or 5 for channel 3, if present! */ sr_session_send(sdi, &packet); - 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 = data; for (i = 0; i < devc->model->num_channels; i++) - analog.data[i] = devc->channel_status[i].output_current_last; /* Value always 0 for channel 3, if present! */ + ((float *)analog.data)[i] = devc->channel_status[i].output_current_last; /* Value always 0 for channel 3, if present! */ sr_session_send(sdi, &packet); sr_sw_limits_update_samples_read(&devc->limits, 1);