]> sigrok.org Git - libsigrok.git/commitdiff
kingst-la2016: rename samplerate member in device context
authorGerhard Sittig <redacted>
Mon, 31 Jan 2022 19:45:51 +0000 (20:45 +0100)
committerGerhard Sittig <redacted>
Sun, 6 Feb 2022 17:53:54 +0000 (18:53 +0100)
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.

src/hardware/kingst-la2016/api.c
src/hardware/kingst-la2016/protocol.c
src/hardware/kingst-la2016/protocol.h

index d1cd4f855cb59c1593743ebb0308e31dc72307b3..cab6517b4fbc9c7b011cc58ece51e3caf431a81c 100644 (file)
@@ -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:
index 86c90ea99ad164e077218a4b1485cde38be05948..976bc3e2dd612bfe818812daaccd2d702fd7b955 100644 (file)
@@ -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);
                                }
                        }
                }
index 452146c2198d45efb299fc0f869e27b9c0ce6cd5..af640f66e508197aa96bc5cc8522aa51a6c65c88 100644 (file)
@@ -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;