+#if WITH_THRESHOLD_SIMPLE
+
+/*
+ * Only list a few discrete voltages, to form a useful set which covers
+ * most logic families. Too many choices can make some applications use
+ * a slider again. Which may lack a scale for the current value, and
+ * leave users without feedback what the currently used value might be.
+ */
+static const double threshold_ranges[][2] = {
+ { 0.4, 0.4, },
+ { 0.6, 0.6, },
+ { 0.9, 0.9, },
+ { 1.2, 1.2, },
+ { 1.4, 1.4, }, /* Default, 1.4V, index 4. */
+ { 2.0, 2.0, },
+ { 2.5, 2.5, },
+ { 4.0, 4.0, },
+};
+#define LOGIC_THRESHOLD_IDX_DFLT 4
+
+static double threshold_voltage(const struct sr_dev_inst *sdi, double *high)
+{
+ struct dev_context *devc;
+ size_t idx;
+ double voltage;
+
+ devc = sdi->priv;
+ idx = devc->threshold_voltage_idx;
+ voltage = threshold_ranges[idx][0];
+ if (high)
+ *high = threshold_ranges[idx][1];
+
+ return voltage;
+}
+
+#else /* WITH_THRESHOLD_SIMPLE */
+