static const uint32_t devopts_cg_analog[] = {
SR_CONF_COUPLING | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
SR_CONF_TRIGGER_SLOPE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
+ SR_CONF_PROBE_FACTOR | SR_CONF_GET | SR_CONF_SET,
};
static const uint32_t devopts_cg_digital[] = {
mso_update_trigger_slope(devc);
devc->coupling = coupling[0];
devc->cur_rate = SR_KHZ(10);
- devc->dso_probe_attn = 10;
+ devc->dso_probe_factor = 10;
devc->limit_samples = MSO_NUM_SAMPLES;
devc->protocol_trigger.spimode = 0;
return SR_ERR_NA;
*data = g_variant_new_string(devc->coupling);
break;
+ case SR_CONF_PROBE_FACTOR:
+ if (!cg_is_analog(cg))
+ return SR_ERR_NA;
+ *data = g_variant_new_uint64(devc->dso_probe_factor);
+ break;
case SR_CONF_TRIGGER_SOURCE:
*data = g_variant_new_string(trigger_sources[devc->trigger_source]);
break;
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
struct dev_context *devc;
- uint64_t num_samples;
+ uint64_t tmp_u64;
int trigger_pos;
double pos;
int idx;
// FIXME
return mso_configure_rate(sdi, g_variant_get_uint64(data));
case SR_CONF_LIMIT_SAMPLES:
- num_samples = g_variant_get_uint64(data);
- if (num_samples != MSO_NUM_SAMPLES) {
+ tmp_u64 = g_variant_get_uint64(data);
+ if (tmp_u64 != MSO_NUM_SAMPLES) {
sr_err("Only %d samples are supported.", MSO_NUM_SAMPLES);
return SR_ERR_ARG;
}
- devc->limit_samples = num_samples;
+ devc->limit_samples = tmp_u64;
break;
case SR_CONF_CAPTURE_RATIO:
break;
return SR_ERR_ARG;
devc->coupling = coupling[idx];
break;
+ case SR_CONF_PROBE_FACTOR:
+ if (!cg_is_analog(cg))
+ return SR_ERR_ARG;
+ tmp_u64 = g_variant_get_uint64(data);
+ if (!tmp_u64)
+ return SR_ERR_ARG;
+ devc->dso_probe_factor = tmp_u64;
+ break;
default:
return SR_ERR_NA;
}
SR_PRIV uint16_t mso_calc_raw_from_mv(struct dev_context *devc)
{
return (uint16_t) (0x200 -
- ((devc->dso_trigger_voltage / devc->dso_probe_attn) /
+ ((devc->dso_trigger_voltage / devc->dso_probe_factor) /
devc->vbit));
}
analog_out[i] = (devc->buffer[i * 3] & 0x3f) |
((devc->buffer[i * 3 + 1] & 0xf) << 6);
analog_out[i] = (512.0 - analog_out[i]) * devc->vbit
- * devc->dso_probe_attn;
+ * devc->dso_probe_factor;
logic_out[i] = ((devc->buffer[i * 3 + 1] & 0x30) >> 4) |
((devc->buffer[i * 3 + 2] & 0x3f) << 2);
}
devc->la_trigger_mask = 0xFF; //the mask for the LA_TRIGGER (bits set to 0 matter, those set to 1 are ignored).
devc->la_trigger = 0x00; //The value of the LA byte that generates a trigger event (in that mode).
devc->dso_trigger_voltage = 3;
- devc->dso_probe_attn = 1;
trigger = sr_session_trigger_get(sdi->session);
if (!trigger)
return SR_OK;