From: Bert Vermeulen Date: Sun, 22 Dec 2013 23:01:59 +0000 (+0100) Subject: Add config keys for setting the number of analog probes. X-Git-Tag: libsigrok-0.3.0~377 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=bf90d4c666cac50308577741e64d7cd42dbaad8d;p=libsigrok.git 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. --- diff --git a/hwdriver.c b/hwdriver.c index 83582ad2..b1d94ccd 100644 --- a/hwdriver.c +++ b/hwdriver.c @@ -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}, }; diff --git a/libsigrok.h b/libsigrok.h index caa13757..a3011320 100644 --- a/libsigrok.h +++ b/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, diff --git a/session_driver.c b/session_driver.c index b023cbc0..2b6bfbbe 100644 --- a/session_driver.c +++ b/session_driver.c @@ -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: diff --git a/session_file.c b/session_file.c index 27e54095..6c794545 100644 --- a/session_file.c +++ b/session_file.c @@ -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);