drivers: Simplify some more trigger slope settings.
This commit is contained in:
parent
3782e57129
commit
db85496ed1
|
@ -486,8 +486,7 @@ static int config_set(uint32_t key, GVariant *data,
|
||||||
case SR_CONF_TRIGGER_SLOPE:
|
case SR_CONF_TRIGGER_SLOPE:
|
||||||
if ((idx = std_str_idx(data, ARRAY_AND_SIZE(trigger_slopes))) < 0)
|
if ((idx = std_str_idx(data, ARRAY_AND_SIZE(trigger_slopes))) < 0)
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
devc->triggerslope = (trigger_slopes[idx][0] == 'r')
|
devc->triggerslope = idx;
|
||||||
? SLOPE_POSITIVE : SLOPE_NEGATIVE;
|
|
||||||
break;
|
break;
|
||||||
case SR_CONF_HORIZ_TRIGGERPOS:
|
case SR_CONF_HORIZ_TRIGGERPOS:
|
||||||
tmp_double = g_variant_get_double(data);
|
tmp_double = g_variant_get_double(data);
|
||||||
|
|
|
@ -53,6 +53,10 @@ static const uint64_t samplerates[] = {
|
||||||
SR_HZ(100),
|
SR_HZ(100),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const char *trigger_slopes[2] = {
|
||||||
|
"r", "f",
|
||||||
|
};
|
||||||
|
|
||||||
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -253,14 +257,9 @@ static int config_set(int key, GVariant *data,
|
||||||
case SR_CONF_CAPTURE_RATIO:
|
case SR_CONF_CAPTURE_RATIO:
|
||||||
break;
|
break;
|
||||||
case SR_CONF_TRIGGER_SLOPE:
|
case SR_CONF_TRIGGER_SLOPE:
|
||||||
slope = g_variant_get_string(data, NULL);
|
if ((idx = std_str_idx(data, ARRAY_AND_SIZE(trigger_slopes))) < 0)
|
||||||
|
|
||||||
if (!slope || !(slope[0] == 'f' || slope[0] == 'r'))
|
|
||||||
sr_err("Invalid trigger slope");
|
|
||||||
return SR_ERR_ARG;
|
return SR_ERR_ARG;
|
||||||
}
|
devc->trigger_slope = idx;
|
||||||
devc->trigger_slope = (slope[0] == 'r')
|
|
||||||
? SLOPE_POSITIVE : SLOPE_NEGATIVE;
|
|
||||||
break;
|
break;
|
||||||
case SR_CONF_HORIZ_TRIGGERPOS:
|
case SR_CONF_HORIZ_TRIGGERPOS:
|
||||||
pos = g_variant_get_double(data);
|
pos = g_variant_get_double(data);
|
||||||
|
|
Loading…
Reference in New Issue