From: Frank Stettner Date: Wed, 10 Apr 2019 09:54:37 +0000 (+0200) Subject: scpi-pps: Add config keys SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE, X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f083ae63c7355b9b1d99775785b99b6fa91cd48a;p=libsigrok.git scpi-pps: Add config keys SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE, SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE and SR_CONF_OVER_TEMPERATURE_PROTECTION_ACTIVE to HP 66xxA power supplies. --- diff --git a/src/hardware/scpi-pps/api.c b/src/hardware/scpi-pps/api.c index 8c3490c5..98ef0b9d 100644 --- a/src/hardware/scpi-pps/api.c +++ b/src/hardware/scpi-pps/api.c @@ -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, ®); + 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, ®); + 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, ®); + 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); diff --git a/src/hardware/scpi-pps/profiles.c b/src/hardware/scpi-pps/profiles.c index efec3ce9..716d783a 100644 --- a/src/hardware/scpi-pps/profiles.c +++ b/src/hardware/scpi-pps/profiles.c @@ -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 };