]> sigrok.org Git - libsigrok.git/commitdiff
agilent-dmm: add basic support for Agilent/Keysight U127x
authorGerd v. Egidy <redacted>
Sun, 10 Feb 2019 19:14:27 +0000 (20:14 +0100)
committerUwe Hermann <redacted>
Wed, 1 May 2019 13:43:00 +0000 (15:43 +0200)
Their commands are very similar to the U123x series, they just
add some more modes and the second channel. So use the re-functions
and just extend them where necessary.

Log reading not supported yet.

Basic testing done with a U1272A.

src/hardware/agilent-dmm/api.c
src/hardware/agilent-dmm/protocol.c
src/hardware/agilent-dmm/protocol.h

index c410b37c02a02276810f9f40e9e2c1655057f007..fe95efb9ae395de2de2e5fa2df2d46ec5397d145 100644 (file)
@@ -60,6 +60,7 @@ extern const struct agdmm_recv agdmm_recvs_u123x[];
 extern const struct agdmm_recv agdmm_recvs_u124x[];
 extern const struct agdmm_recv agdmm_recvs_u124xc[];
 extern const struct agdmm_recv agdmm_recvs_u125x[];
+extern const struct agdmm_recv agdmm_recvs_u127x[];
 extern const struct agdmm_recv agdmm_recvs_u128x[];
 
 /* This works on all the Agilent U12xxA series, although the
@@ -86,6 +87,10 @@ static const struct agdmm_profile supported_agdmm[] = {
        { AGILENT_U1252, "U1252B", 3, agdmm_jobs_live, NULL, agdmm_recvs_u125x },
        { AGILENT_U1253, "U1253B", 3, agdmm_jobs_live, NULL, agdmm_recvs_u125x },
 
+       { AGILENT_U1271, "U1271A", 3, agdmm_jobs_live, NULL, agdmm_recvs_u127x },
+       { AGILENT_U1272, "U1272A", 3, agdmm_jobs_live, NULL, agdmm_recvs_u127x },
+       { AGILENT_U1273, "U1273A", 3, agdmm_jobs_live, NULL, agdmm_recvs_u127x },
+    
        { KEYSIGHT_U1281, "U1281A", 3, agdmm_jobs_live, agdmm_jobs_log, agdmm_recvs_u128x },
        { KEYSIGHT_U1282, "U1282A", 3, agdmm_jobs_live, agdmm_jobs_log, agdmm_recvs_u128x },
        ALL_ZERO
index 1b0adf248f02b14c26471497a77a8bfa983461a6..624ff597a76aad5c1293a99d0d19858c642bc073 100644 (file)
@@ -574,6 +574,12 @@ static int recv_conf_u123x(const struct sr_dev_inst *sdi, GMatchInfo *match)
                devc->cur_mqflags[i] = 0;
                devc->cur_exponent[i] = 0;
                devc->cur_digits[i] = 3 - resolution;
+       } else if (!strcmp(mstr, "MA")) {
+               devc->cur_mq[i] = SR_MQ_CURRENT;
+               devc->cur_unit[i] = SR_UNIT_AMPERE;
+               devc->cur_mqflags[i] = 0;
+               devc->cur_exponent[i] = -3;
+               devc->cur_digits[i] = 8 - resolution;
        } else if (!strcmp(mstr, "UA")) {
                devc->cur_mq[i] = SR_MQ_CURRENT;
                devc->cur_unit[i] = SR_UNIT_AMPERE;
@@ -603,6 +609,12 @@ static int recv_conf_u123x(const struct sr_dev_inst *sdi, GMatchInfo *match)
                devc->cur_mqflags[i] = SR_MQFLAG_DIODE | SR_MQFLAG_DC;
                devc->cur_exponent[i] = 0;
                devc->cur_digits[i] = 3;
+       } else if (!strcmp(mstr, "TEMP")) {
+               devc->cur_mq[i] = SR_MQ_TEMPERATURE;
+               devc->cur_unit[i] = SR_UNIT_CELSIUS;
+               devc->cur_mqflags[i] = 0;
+               devc->cur_exponent[i] = 0;
+               devc->cur_digits[i] = 1;
        } else if (!strcmp(mstr, "CAP")) {
                devc->cur_mq[i] = SR_MQ_CAPACITANCE;
                devc->cur_unit[i] = SR_UNIT_FARAD;
@@ -625,6 +637,8 @@ static int recv_conf_u123x(const struct sr_dev_inst *sdi, GMatchInfo *match)
                                devc->cur_mqflags[i] |= SR_MQFLAG_RMS;
                } else if (!strcmp(mstr, "DC")) {
                        devc->cur_mqflags[i] |= SR_MQFLAG_DC;
+               } else if (!strcmp(mstr, "ACDC")) {
+                       devc->cur_mqflags[i] |= SR_MQFLAG_AC | SR_MQFLAG_DC | SR_MQFLAG_RMS;
                } else {
                        sr_dbg("Unknown first argument '%s'.", mstr);
                }
@@ -632,7 +646,14 @@ static int recv_conf_u123x(const struct sr_dev_inst *sdi, GMatchInfo *match)
        } else
                devc->cur_mqflags[i] &= ~(SR_MQFLAG_AC | SR_MQFLAG_DC);
 
-       return JOB_CONF;
+       struct sr_channel *prev_conf = devc->cur_conf;
+       devc->cur_conf = sr_next_enabled_channel(sdi, devc->cur_conf);
+       if (devc->cur_conf->index >= MIN(devc->profile->nb_channels, 2))
+               devc->cur_conf = sr_next_enabled_channel(sdi, devc->cur_conf);
+       if (devc->cur_conf->index > prev_conf->index)
+               return JOB_AGAIN;
+       else
+               return JOB_CONF;
 }
 
 static int recv_conf_u124x_5x(const struct sr_dev_inst *sdi, GMatchInfo *match)
@@ -1028,6 +1049,16 @@ SR_PRIV const struct agdmm_recv agdmm_recvs_u125x[] = {
        ALL_ZERO
 };
 
+SR_PRIV const struct agdmm_recv agdmm_recvs_u127x[] = {
+       { "^\"(\\d\\d.{18}\\d)\"$", recv_stat_u123x },
+       { "^\\*([0-9])$", recv_switch },
+       { "^([-+][0-9]\\.[0-9]{8}E[-+][0-9]{2})$", recv_fetc },
+       { "^\"(V|MV|A|MA|UA|FREQ),(\\d),(AC|DC|ACDC)\"$", recv_conf_u123x },
+       { "^\"(RES|CAP),(\\d)\"$", recv_conf_u123x},
+       { "^\"(DIOD|TEMP)\"$", recv_conf_u123x },
+       ALL_ZERO
+};
+
 SR_PRIV const struct agdmm_recv agdmm_recvs_u128x[] = {
        { "^\"(\\d\\d.{18}\\d)\"$", recv_stat_u128x },
        { "^\\*([0-9])$", recv_switch },
index 85b5235743eecd703671f97fd38eba6c6125eb8c..5d28e8c77f4be02e3a2d40f066d853010ff07eda 100644 (file)
@@ -54,6 +54,10 @@ enum {
        AGILENT_U1252,
        AGILENT_U1253,
 
+       AGILENT_U1271,
+       AGILENT_U1272,
+       AGILENT_U1273,
+
        KEYSIGHT_U1281,
        KEYSIGHT_U1282,
 };