From: Gerd v. Egidy Date: Sun, 10 Feb 2019 19:14:27 +0000 (+0100) Subject: agilent-dmm: add basic support for Agilent/Keysight U127x X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=16a8e58068a725abd9a8b516c56e7cebe853cc75;p=libsigrok.git agilent-dmm: add basic support for Agilent/Keysight U127x 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. --- diff --git a/src/hardware/agilent-dmm/api.c b/src/hardware/agilent-dmm/api.c index c410b37c..fe95efb9 100644 --- a/src/hardware/agilent-dmm/api.c +++ b/src/hardware/agilent-dmm/api.c @@ -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 diff --git a/src/hardware/agilent-dmm/protocol.c b/src/hardware/agilent-dmm/protocol.c index 1b0adf24..624ff597 100644 --- a/src/hardware/agilent-dmm/protocol.c +++ b/src/hardware/agilent-dmm/protocol.c @@ -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 }, diff --git a/src/hardware/agilent-dmm/protocol.h b/src/hardware/agilent-dmm/protocol.h index 85b52357..5d28e8c7 100644 --- a/src/hardware/agilent-dmm/protocol.h +++ b/src/hardware/agilent-dmm/protocol.h @@ -54,6 +54,10 @@ enum { AGILENT_U1252, AGILENT_U1253, + AGILENT_U1271, + AGILENT_U1272, + AGILENT_U1273, + KEYSIGHT_U1281, KEYSIGHT_U1282, };