]> sigrok.org Git - libsigrok.git/commitdiff
beaglelogic: Flexible sampleunit depending on enabled channels
authorKumar Abhishek <redacted>
Thu, 20 Jul 2017 14:43:10 +0000 (14:43 +0000)
committerUwe Hermann <redacted>
Tue, 26 Sep 2017 16:14:46 +0000 (18:14 +0200)
If a channel in the higher-than-8-bit group is enabled then use
16-bit captures. Otherwise just do 8-bit captures.

Signed-off-by: Kumar Abhishek <redacted>
src/hardware/beaglelogic/api.c

index 464527edb723ba34f7c4fcb9c715937dd1dbb96c..d93f4af3da915a5d1954a2c7a09929595e2c1d67 100644 (file)
@@ -252,15 +252,22 @@ static int config_list(uint32_t key, GVariant **data,
 static int dev_acquisition_start(const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc = sdi->priv;
+       GSList *l;
        struct sr_trigger *trigger;
+       struct sr_channel *channel;
 
        /* Clear capture state */
        devc->bytes_read = 0;
        devc->offset = 0;
 
        /* Configure channels */
-       devc->sampleunit = g_slist_length(sdi->channels) > 8 ?
-                       BL_SAMPLEUNIT_16_BITS : BL_SAMPLEUNIT_8_BITS;
+       devc->sampleunit = BL_SAMPLEUNIT_8_BITS;
+
+       for (l = sdi->channels; l; l = l->next) {
+               channel = l->data;
+               if (channel->index >= 8 && channel->enabled)
+                       devc->sampleunit = BL_SAMPLEUNIT_16_BITS;
+       }
        beaglelogic_set_sampleunit(devc);
 
        /* Configure triggers & send header packet */