From: Bert Vermeulen Date: Tue, 5 Jun 2012 15:37:28 +0000 (+0200) Subject: sr: add unit field to sr_df_analog packet X-Git-Tag: dsupstream~922 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=aff5a729abfaa016555f5d4a6a1e2c953405179d;p=libsigrok.git sr: add unit field to sr_df_analog packet --- diff --git a/hardware/hantek-dso/api.c b/hardware/hantek-dso/api.c index 23d26842..5f2301ff 100644 --- a/hardware/hantek-dso/api.c +++ b/hardware/hantek-dso/api.c @@ -574,6 +574,7 @@ static void receive_transfer(struct libusb_transfer *transfer) packet.payload = &analog; /* TODO: support for 5xxx series 9-bit samples */ analog.num_samples = transfer->actual_length / 2; + analog.unit = SR_UNIT_VOLTAGE; analog.data = g_try_malloc(analog.num_samples * sizeof(float) * num_probes); data_offset = 0; for (i = 0; i < analog.num_samples; i++) { diff --git a/sigrok.h.in b/sigrok.h.in index 5fc1e187..304f1d8f 100644 --- a/sigrok.h.in +++ b/sigrok.h.in @@ -167,6 +167,12 @@ enum { SR_DF_FRAME_END, }; +/* sr_datafeed_analog.unit values */ +enum { + SR_UNIT_VOLTAGE, + SR_UNIT_CURRENT, +}; + struct sr_datafeed_packet { uint16_t type; void *payload; @@ -194,6 +200,7 @@ struct sr_datafeed_meta_analog { struct sr_datafeed_analog { int num_samples; + int unit; float *data; };