From: Gerhard Sittig Date: Mon, 31 Jan 2022 19:45:51 +0000 (+0100) Subject: kingst-la2016: rename samplerate member in device context X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=edc0b015dd4e9f904811273b31966f14b9533979;p=libsigrok.git kingst-la2016: rename samplerate member in device context The "current samplerate" attribute of the device context became obsolete when the maximum samplerate became a property of the model which a device context references. --- diff --git a/src/hardware/kingst-la2016/api.c b/src/hardware/kingst-la2016/api.c index d1cd4f85..cab6517b 100644 --- a/src/hardware/kingst-la2016/api.c +++ b/src/hardware/kingst-la2016/api.c @@ -617,7 +617,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sr_sw_limits_init(&devc->sw_limits); devc->sw_limits.limit_samples = 0; devc->capture_ratio = 50; - devc->cur_samplerate = devc->model->samplerate; + devc->samplerate = devc->model->samplerate; devc->threshold_voltage_idx = LOGIC_THRESHOLD_IDX_DFLT; if (ARRAY_SIZE(devc->pwm_setting) >= 1) { devc->pwm_setting[0].enabled = FALSE; @@ -796,7 +796,7 @@ static int config_get(uint32_t key, GVariant **data, *data = g_variant_new_printf("%d.%d", usb->bus, usb->address); break; case SR_CONF_SAMPLERATE: - *data = g_variant_new_uint64(devc->cur_samplerate); + *data = g_variant_new_uint64(devc->samplerate); break; case SR_CONF_LIMIT_SAMPLES: case SR_CONF_LIMIT_MSEC: @@ -888,7 +888,7 @@ static int config_set(uint32_t key, GVariant *data, switch (key) { case SR_CONF_SAMPLERATE: - devc->cur_samplerate = g_variant_get_uint64(data); + devc->samplerate = g_variant_get_uint64(data); break; case SR_CONF_LIMIT_SAMPLES: case SR_CONF_LIMIT_MSEC: diff --git a/src/hardware/kingst-la2016/protocol.c b/src/hardware/kingst-la2016/protocol.c index 86c90ea9..976bc3e2 100644 --- a/src/hardware/kingst-la2016/protocol.c +++ b/src/hardware/kingst-la2016/protocol.c @@ -622,19 +622,19 @@ static int set_sample_config(const struct sr_dev_inst *sdi) devc = sdi->priv; - if (devc->cur_samplerate > devc->model->samplerate) { + if (devc->samplerate > devc->model->samplerate) { sr_err("Too high a sample rate: %" PRIu64 ".", - devc->cur_samplerate); + devc->samplerate); return SR_ERR_ARG; } min_samplerate = devc->model->samplerate; min_samplerate /= 65536; - if (devc->cur_samplerate < min_samplerate) { + if (devc->samplerate < min_samplerate) { sr_err("Too low a sample rate: %" PRIu64 ".", - devc->cur_samplerate); + devc->samplerate); return SR_ERR_ARG; } - divider_u16 = devc->model->samplerate / devc->cur_samplerate; + divider_u16 = devc->model->samplerate / devc->samplerate; eff_samplerate = devc->model->samplerate / divider_u16; ret = sr_sw_limits_get_remain(&devc->sw_limits, @@ -1084,7 +1084,7 @@ static void send_chunk(struct sr_dev_inst *sdi, devc->trigger_marked = TRUE; sr_dbg("Trigger position after %" PRIu64 " samples, %.6fms.", devc->total_samples, - (double)devc->total_samples / devc->cur_samplerate * 1e3); + (double)devc->total_samples / devc->samplerate * 1e3); } } } diff --git a/src/hardware/kingst-la2016/protocol.h b/src/hardware/kingst-la2016/protocol.h index 452146c2..af640f66 100644 --- a/src/hardware/kingst-la2016/protocol.h +++ b/src/hardware/kingst-la2016/protocol.h @@ -113,7 +113,7 @@ struct dev_context { float duty; } pwm_setting[LA2016_NUM_PWMCH_MAX]; size_t threshold_voltage_idx; - uint64_t cur_samplerate; + uint64_t samplerate; struct sr_sw_limits sw_limits; uint64_t capture_ratio;