]> sigrok.org Git - libsigrok.git/commitdiff
rigol-ds: Add the TRIGGER_SLOPE entry to config_get() and config_list()
authorAurelien Jacobs <redacted>
Tue, 25 Mar 2014 22:09:57 +0000 (23:09 +0100)
committerAurelien Jacobs <redacted>
Tue, 25 Mar 2014 22:11:31 +0000 (23:11 +0100)
hardware/rigol-ds/api.c

index 57bfd033a8587a34dc286cb94521d83502aedc46..b8dbe89fdb28e8ff0f8729d2a0bdb64638723dcb 100644 (file)
@@ -143,6 +143,11 @@ static const char *trigger_sources[] = {
        "D15",
 };
 
+static const char *trigger_slopes[] = {
+       "r",
+       "f",
+};
+
 static const char *coupling[] = {
        "AC",
        "DC",
@@ -546,6 +551,15 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
                        tmp_str = devc->trigger_source;
                *data = g_variant_new_string(tmp_str);
                break;
+       case SR_CONF_TRIGGER_SLOPE:
+               if (!strcmp(devc->trigger_slope, "POS"))
+                       tmp_str = "r";
+               else if (!strcmp(devc->trigger_slope, "NEG"))
+                       tmp_str = "f";
+               else
+                       return SR_ERR_NA;
+               *data = g_variant_new_string(tmp_str);
+               break;
        case SR_CONF_TIMEBASE:
                for (i = 0; i < devc->num_timebases; i++) {
                        float tb = (float)devc->timebases[i][0] / devc->timebases[i][1];
@@ -838,6 +852,9 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
                *data = g_variant_new_strv(trigger_sources,
                                devc->model->has_digital ? ARRAY_SIZE(trigger_sources) : 4);
                break;
+       case SR_CONF_TRIGGER_SLOPE:
+               *data = g_variant_new_strv(trigger_slopes, ARRAY_SIZE(trigger_slopes));
+               break;
        case SR_CONF_DATA_SOURCE:
                if (!devc)
                        /* Can't know this until we have the exact model. */