SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
SR_CONF_TRIGGER_MATCH | SR_CONF_LIST,
SR_CONF_CONN | SR_CONF_GET,
- SR_CONF_VOLTAGE_THRESHOLD | SR_CONF_SET | SR_CONF_LIST,
+ SR_CONF_VOLTAGE_THRESHOLD | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
};
static const int32_t trigger_matches[] = {
/* Initialize command packet. */
devc->cmd_pkt.magic = H4032L_CMD_PKT_MAGIC;
- devc->cmd_pkt.pwm_a = h4032l_voltage2pwm(2.5);
- devc->cmd_pkt.pwm_b = h4032l_voltage2pwm(2.5);
devc->cmd_pkt.sample_size = 16384;
devc->status = H4032L_STATUS_IDLE;
devc->capture_ratio = 5;
+ devc->cur_threshold = 2.5;
sdi->priv = devc;
devices = g_slist_append(devices, sdi);
(void)cg;
switch (key) {
+ case SR_CONF_VOLTAGE_THRESHOLD:
+ *data = std_gvar_tuple_double(devc->cur_threshold, devc->cur_threshold);
+ break;
case SR_CONF_SAMPLERATE:
*data = g_variant_new_uint64(samplerates_hw[devc->cmd_pkt.sample_rate]);
break;
break;
}
case SR_CONF_VOLTAGE_THRESHOLD: {
- double d1, d2;
- g_variant_get(data, "(dd)", &d1, &d2);
- devc->cmd_pkt.pwm_a = h4032l_voltage2pwm(d1);
- devc->cmd_pkt.pwm_b = h4032l_voltage2pwm(d2);
+ double low, high;
+ g_variant_get(data, "(dd)", &low, &high);
+ devc->cur_threshold = (low+high)/2.0;
break;
}
default:
*data = std_gvar_array_i32(ARRAY_AND_SIZE(trigger_matches));
break;
case SR_CONF_VOLTAGE_THRESHOLD:
- *data = std_gvar_tuple_double(2.5, 2.5);
+ *data = std_gvar_min_max_step_thresholds(-6.0, 6.0, 0.1);
break;
case SR_CONF_LIMIT_SAMPLES:
*data = std_gvar_tuple_u64(H4043L_NUM_SAMPLES_MIN, H4032L_NUM_SAMPLES_MAX);
cmd_pkt->pre_trigger_size = (cmd_pkt->sample_size * devc->capture_ratio) / 100;
devc->trigger_pos = cmd_pkt->pre_trigger_size;
+ /* Set pwm channel values. */
+ devc->cmd_pkt.pwm_a = h4032l_voltage2pwm(devc->cur_threshold);
+ devc->cmd_pkt.pwm_b = devc->cmd_pkt.pwm_a;
+
cmd_pkt->trig_flags.enable_trigger1 = 0;
cmd_pkt->trig_flags.enable_trigger2 = 0;
cmd_pkt->trig_flags.trigger_and_logic = 0;