Add config keys for setting the number of analog probes.
This is primarily of use in the demo driver, but this patch also takes in the logic probe setting config key used only by the session driver so far.
This commit is contained in:
parent
3699a8a1ff
commit
bf90d4c666
|
@ -96,6 +96,10 @@ static struct sr_config_info sr_config_info_data[] = {
|
|||
"Power off", NULL},
|
||||
{SR_CONF_DATA_SOURCE, SR_T_CHAR, "data_source",
|
||||
"Data source", NULL},
|
||||
{SR_CONF_NUM_LOGIC_PROBES, SR_T_INT32, "logic_probes",
|
||||
"Number of logic probes", NULL},
|
||||
{SR_CONF_NUM_ANALOG_PROBES, SR_T_INT32, "analog_probes",
|
||||
"Number of analog probes", NULL},
|
||||
{0, 0, NULL, NULL, NULL},
|
||||
};
|
||||
|
||||
|
|
22
libsigrok.h
22
libsigrok.h
|
@ -145,6 +145,7 @@ enum {
|
|||
SR_T_KEYVALUE,
|
||||
SR_T_UINT64_RANGE,
|
||||
SR_T_DOUBLE_RANGE,
|
||||
SR_T_INT32,
|
||||
};
|
||||
|
||||
/** Value for sr_datafeed_packet.type. */
|
||||
|
@ -785,7 +786,7 @@ enum {
|
|||
/** Logic low-high threshold range. */
|
||||
SR_CONF_VOLTAGE_THRESHOLD,
|
||||
|
||||
/** The device supports using a external clock. */
|
||||
/** The device supports using an external clock. */
|
||||
SR_CONF_EXTERNAL_CLOCK,
|
||||
|
||||
/**
|
||||
|
@ -794,11 +795,17 @@ enum {
|
|||
*/
|
||||
SR_CONF_SWAP,
|
||||
|
||||
/** Center frequency.
|
||||
* The input signal is downmixed by this frequency before the ADC
|
||||
* anti-aliasing filter.
|
||||
*/
|
||||
SR_CONF_CENTER_FREQUENCY,
|
||||
/** Center frequency.
|
||||
* The input signal is downmixed by this frequency before the ADC
|
||||
* anti-aliasing filter.
|
||||
*/
|
||||
SR_CONF_CENTER_FREQUENCY,
|
||||
|
||||
/** The device supports setting the number of logic probes. */
|
||||
SR_CONF_NUM_LOGIC_PROBES,
|
||||
|
||||
/** The device supports setting the number of analog probes. */
|
||||
SR_CONF_NUM_ANALOG_PROBES,
|
||||
|
||||
/*--- Special stuff -------------------------------------------------*/
|
||||
|
||||
|
@ -817,9 +824,6 @@ enum {
|
|||
/** The device supports specifying the capturefile unit size. */
|
||||
SR_CONF_CAPTURE_UNITSIZE,
|
||||
|
||||
/** The device supports setting the number of probes. */
|
||||
SR_CONF_CAPTURE_NUM_PROBES,
|
||||
|
||||
/** Power off the device. */
|
||||
SR_CONF_POWER_OFF,
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
|
|||
case SR_CONF_CAPTURE_UNITSIZE:
|
||||
vdev->unitsize = g_variant_get_uint64(data);
|
||||
break;
|
||||
case SR_CONF_CAPTURE_NUM_PROBES:
|
||||
case SR_CONF_NUM_LOGIC_PROBES:
|
||||
vdev->num_probes = g_variant_get_uint64(data);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -181,7 +181,7 @@ SR_API int sr_session_load(const char *filename)
|
|||
g_variant_new_uint64(tmp_u64), sdi, NULL);
|
||||
} else if (!strcmp(keys[j], "total probes")) {
|
||||
total_probes = strtoull(val, NULL, 10);
|
||||
sdi->driver->config_set(SR_CONF_CAPTURE_NUM_PROBES,
|
||||
sdi->driver->config_set(SR_CONF_NUM_LOGIC_PROBES,
|
||||
g_variant_new_uint64(total_probes), sdi, NULL);
|
||||
for (p = 0; p < total_probes; p++) {
|
||||
snprintf(probename, SR_MAX_PROBENAME_LEN, "%" PRIu64, p);
|
||||
|
|
Loading…
Reference in New Issue