]> sigrok.org Git - libsigrok.git/commitdiff
scpi-pps: Add config keys SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE,
authorFrank Stettner <redacted>
Wed, 10 Apr 2019 09:54:37 +0000 (11:54 +0200)
committerUwe Hermann <redacted>
Wed, 17 Apr 2019 15:44:59 +0000 (17:44 +0200)
SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE and
SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE to HP 66xxA power supplies.

src/hardware/scpi-pps/api.c
src/hardware/scpi-pps/profiles.c

index 8c3490c5a35ca926f24fb1bd25a49d8f61a38ca3..98ef0b9d7b01932fb902e77bdd21d13a9704c882 100644 (file)
@@ -383,7 +383,8 @@ static int config_get(uint32_t key, GVariant **data,
                cmd = SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ENABLED;
                break;
        case SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE:
-               if (devc->device->dialect == SCPI_DIALECT_HP_66XXB)
+               if (devc->device->dialect == SCPI_DIALECT_HP_66XXB ||
+                       devc->device->dialect == SCPI_DIALECT_HP_COMP)
                        gvtype = G_VARIANT_TYPE_STRING;
                else
                        gvtype = G_VARIANT_TYPE_BOOLEAN;
@@ -398,7 +399,8 @@ static int config_get(uint32_t key, GVariant **data,
                cmd = SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ENABLED;
                break;
        case SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE:
-               if (devc->device->dialect == SCPI_DIALECT_HP_66XXB)
+               if (devc->device->dialect == SCPI_DIALECT_HP_66XXB ||
+                       devc->device->dialect == SCPI_DIALECT_HP_COMP)
                        gvtype = G_VARIANT_TYPE_STRING;
                else
                        gvtype = G_VARIANT_TYPE_BOOLEAN;
@@ -413,7 +415,8 @@ static int config_get(uint32_t key, GVariant **data,
                cmd = SCPI_CMD_GET_OVER_TEMPERATURE_PROTECTION;
                break;
        case SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE:
-               if (devc->device->dialect == SCPI_DIALECT_HP_66XXB)
+               if (devc->device->dialect == SCPI_DIALECT_HP_66XXB ||
+                       devc->device->dialect == SCPI_DIALECT_HP_COMP)
                        gvtype = G_VARIANT_TYPE_STRING;
                else
                        gvtype = G_VARIANT_TYPE_BOOLEAN;
@@ -500,6 +503,13 @@ static int config_get(uint32_t key, GVariant **data,
        }
 
        if (cmd == SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ACTIVE) {
+               if (devc->device->dialect == SCPI_DIALECT_HP_COMP) {
+                       /* Evaluate Status Register from a HP 66xx in COMP mode. */
+                       s = g_variant_get_string(*data, NULL);
+                       sr_atoi(s, &reg);
+                       g_variant_unref(*data);
+                       *data = g_variant_new_boolean(reg & (1 << 3));
+               }
                if (devc->device->dialect == SCPI_DIALECT_HP_66XXB) {
                        /* Evaluate Questionable Status Register bit 0 from a HP 66xxB. */
                        s = g_variant_get_string(*data, NULL);
@@ -510,6 +520,13 @@ static int config_get(uint32_t key, GVariant **data,
        }
 
        if (cmd == SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ACTIVE) {
+               if (devc->device->dialect == SCPI_DIALECT_HP_COMP) {
+                       /* Evaluate Status Register from a HP 66xx in COMP mode. */
+                       s = g_variant_get_string(*data, NULL);
+                       sr_atoi(s, &reg);
+                       g_variant_unref(*data);
+                       *data = g_variant_new_boolean(reg & (1 << 6));
+               }
                if (devc->device->dialect == SCPI_DIALECT_HP_66XXB) {
                        /* Evaluate Questionable Status Register bit 1 from a HP 66xxB. */
                        s = g_variant_get_string(*data, NULL);
@@ -520,6 +537,13 @@ static int config_get(uint32_t key, GVariant **data,
        }
 
        if (cmd == SCPI_CMD_GET_OVER_TEMPERATURE_PROTECTION_ACTIVE) {
+               if (devc->device->dialect == SCPI_DIALECT_HP_COMP) {
+                       /* Evaluate Status Register from a HP 66xx in COMP mode. */
+                       s = g_variant_get_string(*data, NULL);
+                       sr_atoi(s, &reg);
+                       g_variant_unref(*data);
+                       *data = g_variant_new_boolean(reg & (1 << 4));
+               }
                if (devc->device->dialect == SCPI_DIALECT_HP_66XXB) {
                        /* Evaluate Questionable Status Register bit 4 from a HP 66xxB. */
                        s = g_variant_get_string(*data, NULL);
index efec3ce9b49bcfd8e5443296c99f0ac6d4237e67..716d783a901069496c716472d29e61b7e903e376 100644 (file)
@@ -442,8 +442,11 @@ static const uint32_t hp_6630a_devopts_cg[] = {
        SR_CONF_CURRENT | SR_CONF_GET,
        SR_CONF_VOLTAGE_TARGET | SR_CONF_SET | SR_CONF_LIST,
        SR_CONF_CURRENT_LIMIT | SR_CONF_SET | SR_CONF_LIST,
+       SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE | SR_CONF_GET,
        SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD | SR_CONF_SET | SR_CONF_LIST,
        SR_CONF_OVER_CURRENT_PROTECTION_ENABLED | SR_CONF_SET,
+       SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE | SR_CONF_GET,
+       SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE | SR_CONF_GET,
        SR_CONF_REGULATION | SR_CONF_GET,
 };
 
@@ -462,9 +465,12 @@ static const struct scpi_command hp_6630a_cmd[] = {
        { SCPI_CMD_GET_MEAS_CURRENT, "IOUT?" },
        { SCPI_CMD_SET_VOLTAGE_TARGET, "VSET %.4f" },
        { SCPI_CMD_SET_CURRENT_LIMIT, "ISET %.4f" },
+       { SCPI_CMD_GET_OVER_VOLTAGE_PROTECTION_ACTIVE, "STS?" },
+       { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, "OVSET %.4f" },
        { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_ENABLE, "OCP 1" },
        { SCPI_CMD_SET_OVER_CURRENT_PROTECTION_DISABLE, "OCP 0" },
-       { SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, "OVSET %.4f" },
+       { SCPI_CMD_GET_OVER_CURRENT_PROTECTION_ACTIVE, "STS?" },
+       { SCPI_CMD_GET_OVER_TEMPERATURE_PROTECTION_ACTIVE, "STS?" },
        { SCPI_CMD_GET_OUTPUT_REGULATION, "STS?" },
        ALL_ZERO
 };