]> sigrok.org Git - libsigrok.git/commitdiff
sr: add unit field to sr_df_analog packet
authorBert Vermeulen <redacted>
Tue, 5 Jun 2012 15:37:28 +0000 (17:37 +0200)
committerBert Vermeulen <redacted>
Tue, 5 Jun 2012 16:18:23 +0000 (18:18 +0200)
hardware/hantek-dso/api.c
sigrok.h.in

index 23d268424b4403e0fc588cef172bcf49826295fb..5f2301ff9167eff0ac7fe48e5f038dc0dc05df9e 100644 (file)
@@ -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++) {
index 5fc1e1871524d2497e28674d1a06c70ec4dc371f..304f1d8f4f4f217e90a0da038a7c3044c86e4b2c 100644 (file)
@@ -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;
 };