maynuo-m97: Convert to SR_DF_ANALOG.

This commit is contained in:
Uwe Hermann 2016-05-28 17:46:17 +02:00
parent ddfe99d92f
commit 94885d200d
1 changed files with 11 additions and 7 deletions

View File

@ -128,19 +128,23 @@ SR_PRIV const char *maynuo_m97_mode_to_str(enum maynuo_m97_mode mode)
static void maynuo_m97_session_send_value(const struct sr_dev_inst *sdi, struct sr_channel *ch, float value, enum sr_mq mq, enum sr_unit unit) static void maynuo_m97_session_send_value(const struct sr_dev_inst *sdi, struct sr_channel *ch, float value, enum sr_mq mq, enum sr_unit unit)
{ {
struct sr_datafeed_packet packet; 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;
analog.channels = g_slist_append(NULL, ch); sr_analog_init(&analog, &encoding, &meaning, &spec, 0);
analog.meaning->channels = g_slist_append(NULL, ch);
analog.num_samples = 1; analog.num_samples = 1;
analog.data = &value; analog.data = &value;
analog.mq = mq; analog.meaning->mq = mq;
analog.unit = unit; analog.meaning->unit = unit;
analog.mqflags = SR_MQFLAG_DC; analog.meaning->mqflags = SR_MQFLAG_DC;
packet.type = SR_DF_ANALOG_OLD; packet.type = SR_DF_ANALOG;
packet.payload = &analog; packet.payload = &analog;
sr_session_send(sdi, &packet); sr_session_send(sdi, &packet);
g_slist_free(analog.channels); g_slist_free(analog.meaning->channels);
} }
SR_PRIV int maynuo_m97_capture_start(const struct sr_dev_inst *sdi) SR_PRIV int maynuo_m97_capture_start(const struct sr_dev_inst *sdi)