summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <sigrok-dev@marcschink.de>2017-03-31 15:44:04 +0200
committerMarc Schink <sigrok-dev@marcschink.de>2017-03-31 16:18:28 +0200
commite720a79359b22599622677410107097bc1d14153 (patch)
treeacca4e45c236bbdd3e6fa118e005e24ae5ea90ac
parentf8b59b52dada805bdb4c77e933bc37be68c09949 (diff)
TODO: scpi-pps: Add support for master outputhmc8043_pps
-rw-r--r--src/hardware/scpi-pps/api.c45
-rw-r--r--src/hardware/scpi-pps/profiles.c4
-rw-r--r--src/hardware/scpi-pps/protocol.h3
3 files changed, 44 insertions, 8 deletions
diff --git a/src/hardware/scpi-pps/api.c b/src/hardware/scpi-pps/api.c
index 57bdcb8..eacde30 100644
--- a/src/hardware/scpi-pps/api.c
+++ b/src/hardware/scpi-pps/api.c
@@ -319,11 +319,13 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
unsigned int i;
int cmd, ret;
const char *s;
+ gboolean use_master_output;
if (!sdi)
return SR_ERR_ARG;
devc = sdi->priv;
+ use_master_output = FALSE;
if (cg) {
/*
@@ -343,6 +345,11 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
break;
}
}
+ } else {
+ for (i = 0; devc->device->commands[i].string; i++) {
+ if (devc->device->commands[i].command == SCPI_CMD_GET_MASTER_OUTPUT_ENABLED)
+ use_master_output = TRUE;
+ }
}
gvtype = NULL;
@@ -350,7 +357,10 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
switch (key) {
case SR_CONF_ENABLED:
gvtype = G_VARIANT_TYPE_BOOLEAN;
- cmd = SCPI_CMD_GET_OUTPUT_ENABLED;
+ if (use_master_output)
+ cmd = SCPI_CMD_GET_MASTER_OUTPUT_ENABLED;
+ else
+ cmd = SCPI_CMD_GET_OUTPUT_ENABLED;
break;
case SR_CONF_VOLTAGE:
gvtype = G_VARIANT_TYPE_DOUBLE;
@@ -413,6 +423,7 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
if (cg)
select_channel(sdi, cg->channels->data);
+
ret = scpi_cmd_resp(sdi, devc->device->commands, data, gvtype, cmd);
if (cmd == SCPI_CMD_GET_OUTPUT_REGULATION) {
@@ -443,9 +454,11 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
+ unsigned int i;
struct dev_context *devc;
double d;
int ret;
+ gboolean use_master_output;
if (!sdi)
return SR_ERR_ARG;
@@ -453,20 +466,36 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- if (cg)
+ devc = sdi->priv;
+ use_master_output = FALSE;
+
+ if (cg) {
/* Channel group specified. */
select_channel(sdi, cg->channels->data);
-
- devc = sdi->priv;
+ } else {
+ for (i = 0; devc->device->commands[i].string; i++) {
+ if (devc->device->commands[i].command == SCPI_CMD_SET_MASTER_OUTPUT_ENABLE)
+ use_master_output = TRUE;
+ }
+ }
switch (key) {
case SR_CONF_ENABLED:
- if (g_variant_get_boolean(data))
- ret = scpi_cmd(sdi, devc->device->commands,
+ if (use_master_output) {
+ if (g_variant_get_boolean(data))
+ ret = scpi_cmd(sdi, devc->device->commands,
+ SCPI_CMD_SET_MASTER_OUTPUT_ENABLE);
+ else
+ ret = scpi_cmd(sdi, devc->device->commands,
+ SCPI_CMD_SET_MASTER_OUTPUT_DISABLE);
+ } else {
+ if (g_variant_get_boolean(data))
+ ret = scpi_cmd(sdi, devc->device->commands,
SCPI_CMD_SET_OUTPUT_ENABLE);
- else
- ret = scpi_cmd(sdi, devc->device->commands,
+ else
+ ret = scpi_cmd(sdi, devc->device->commands,
SCPI_CMD_SET_OUTPUT_DISABLE);
+ }
break;
case SR_CONF_VOLTAGE_TARGET:
d = g_variant_get_double(data);
diff --git a/src/hardware/scpi-pps/profiles.c b/src/hardware/scpi-pps/profiles.c
index 75be9ef..dbdf91a 100644
--- a/src/hardware/scpi-pps/profiles.c
+++ b/src/hardware/scpi-pps/profiles.c
@@ -517,6 +517,7 @@ static const struct scpi_command philips_pm2800_cmd[] = {
static const uint32_t rs_hmc8043_devopts[] = {
SR_CONF_CONTINUOUS,
+ SR_CONF_ENABLED | SR_CONF_GET | SR_CONF_SET,
};
static const uint32_t rs_hmc8043_devopts_cg[] = {
@@ -553,6 +554,9 @@ static const struct scpi_command rs_hmc8043_cmd[] = {
{ SCPI_CMD_GET_OUTPUT_ENABLED, "OUTP?" },
{ SCPI_CMD_SET_OUTPUT_ENABLE, "OUTP ON" },
{ SCPI_CMD_SET_OUTPUT_DISABLE, "OUTP OFF" },
+ { SCPI_CMD_GET_MASTER_OUTPUT_ENABLED, "OUTP:MAST?" },
+ { SCPI_CMD_SET_MASTER_OUTPUT_ENABLE, "OUTP:MAST ON" },
+ { SCPI_CMD_SET_MASTER_OUTPUT_DISABLE, "OUTP:MAST OFF" },
{ SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ACTIVE, "VOLT:PROT:TRIP?" },
{ SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_THRESHOLD, "VOLT:PROT:LEV?" },
{ SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, "VOLT:PROT:LEV %.6f" },
diff --git a/src/hardware/scpi-pps/protocol.h b/src/hardware/scpi-pps/protocol.h
index 80593ce..d9a712d 100644
--- a/src/hardware/scpi-pps/protocol.h
+++ b/src/hardware/scpi-pps/protocol.h
@@ -49,6 +49,9 @@ enum pps_scpi_cmds {
SCPI_CMD_SET_OUTPUT_ENABLE,
SCPI_CMD_SET_OUTPUT_DISABLE,
SCPI_CMD_GET_OUTPUT_REGULATION,
+ SCPI_CMD_GET_MASTER_OUTPUT_ENABLED,
+ SCPI_CMD_SET_MASTER_OUTPUT_ENABLE,
+ SCPI_CMD_SET_MASTER_OUTPUT_DISABLE,
SCPI_CMD_GET_OVER_TEMPERATURE_PROTECTION,
SCPI_CMD_SET_OVER_TEMPERATURE_PROTECTION_ENABLE,
SCPI_CMD_SET_OVER_TEMPERATURE_PROTECTION_DISABLE,