]> sigrok.org Git - libsigrok.git/commitdiff
rigol-ds: Calculate effective samplerate.
authorMartin Ling <redacted>
Tue, 14 Jan 2014 21:27:58 +0000 (21:27 +0000)
committerUwe Hermann <redacted>
Fri, 17 Jan 2014 00:52:29 +0000 (01:52 +0100)
hardware/rigol-ds/api.c

index ec67d22d9372c1b3f33bb8310d2cd146089eb189..02abae9bfb5f1a20797d12f19f876ff2028b0826 100644 (file)
@@ -41,6 +41,7 @@ static const int32_t hwcaps[] = {
        SR_CONF_HORIZ_TRIGGERPOS,
        SR_CONF_NUM_TIMEBASE,
        SR_CONF_LIMIT_FRAMES,
+       SR_CONF_SAMPLERATE,
 };
 
 static const int32_t analog_hwcaps[] = {
@@ -517,6 +518,15 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
                else
                        *data = g_variant_new_string("Segmented");
                break;
+       case SR_CONF_SAMPLERATE:
+               if (devc->data_source == DATA_SOURCE_LIVE) {
+                       uint64_t samplerate = analog_frame_size(sdi) /
+                               (devc->timebase * devc->model->num_horizontal_divs);
+                       *data = g_variant_new_uint64(samplerate);
+               }
+               else
+                       return SR_ERR_NA;
+               break;
        default:
                return SR_ERR_NA;
        }