From: Martin Ling Date: Tue, 14 Jan 2014 21:27:58 +0000 (+0000) Subject: rigol-ds: Calculate effective samplerate. X-Git-Tag: libsigrok-0.3.0~256 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=4914dd4b9a9e38b72aa351a0322e812c9d6a0384;p=libsigrok.git rigol-ds: Calculate effective samplerate. --- diff --git a/hardware/rigol-ds/api.c b/hardware/rigol-ds/api.c index ec67d22d..02abae9b 100644 --- a/hardware/rigol-ds/api.c +++ b/hardware/rigol-ds/api.c @@ -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; }