X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fscpi-pps%2Fapi.c;h=6ffc17d4f7ca1d03fcd3e7862d969edb346bad83;hb=f6c685e4d340b52962c2ae983974936071578156;hp=f97b07109eae6ffb66e105d764979620934b6bff;hpb=53012da658ae94b245240c8a3e115723eede4c7d;p=libsigrok.git diff --git a/src/hardware/scpi-pps/api.c b/src/hardware/scpi-pps/api.c index f97b0710..6ffc17d4 100644 --- a/src/hardware/scpi-pps/api.c +++ b/src/hardware/scpi-pps/api.c @@ -299,8 +299,8 @@ static int dev_clear(const struct sr_dev_driver *di) return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper); } -static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *cg) +static int config_get(uint32_t key, GVariant **data, + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; const GVariantType *gvtype; @@ -428,12 +428,11 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s return ret; } -static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *cg) +static int config_set(uint32_t key, GVariant *data, + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; double d; - int ret; if (!sdi) return SR_ERR_ARG; @@ -446,70 +445,70 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd switch (key) { case SR_CONF_ENABLED: if (g_variant_get_boolean(data)) - ret = scpi_cmd(sdi, devc->device->commands, + return scpi_cmd(sdi, devc->device->commands, SCPI_CMD_SET_OUTPUT_ENABLE); else - ret = scpi_cmd(sdi, devc->device->commands, + return scpi_cmd(sdi, devc->device->commands, SCPI_CMD_SET_OUTPUT_DISABLE); break; case SR_CONF_VOLTAGE_TARGET: d = g_variant_get_double(data); - ret = scpi_cmd(sdi, devc->device->commands, + return scpi_cmd(sdi, devc->device->commands, SCPI_CMD_SET_VOLTAGE_TARGET, d); break; case SR_CONF_OUTPUT_FREQUENCY_TARGET: d = g_variant_get_double(data); - ret = scpi_cmd(sdi, devc->device->commands, + return scpi_cmd(sdi, devc->device->commands, SCPI_CMD_SET_FREQUENCY_TARGET, d); break; case SR_CONF_CURRENT_LIMIT: d = g_variant_get_double(data); - ret = scpi_cmd(sdi, devc->device->commands, + return scpi_cmd(sdi, devc->device->commands, SCPI_CMD_SET_CURRENT_LIMIT, d); break; case SR_CONF_OVER_VOLTAGE_PROTECTION_ENABLED: if (g_variant_get_boolean(data)) - ret = scpi_cmd(sdi, devc->device->commands, + return scpi_cmd(sdi, devc->device->commands, SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_ENABLE); else - ret = scpi_cmd(sdi, devc->device->commands, + return scpi_cmd(sdi, devc->device->commands, SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_DISABLE); break; case SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD: d = g_variant_get_double(data); - ret = scpi_cmd(sdi, devc->device->commands, + return scpi_cmd(sdi, devc->device->commands, SCPI_CMD_SET_OVER_VOLTAGE_PROTECTION_THRESHOLD, d); break; case SR_CONF_OVER_CURRENT_PROTECTION_ENABLED: if (g_variant_get_boolean(data)) - ret = scpi_cmd(sdi, devc->device->commands, + return scpi_cmd(sdi, devc->device->commands, SCPI_CMD_SET_OVER_CURRENT_PROTECTION_ENABLE); else - ret = scpi_cmd(sdi, devc->device->commands, + return scpi_cmd(sdi, devc->device->commands, SCPI_CMD_SET_OVER_CURRENT_PROTECTION_DISABLE); break; case SR_CONF_OVER_CURRENT_PROTECTION_THRESHOLD: d = g_variant_get_double(data); - ret = scpi_cmd(sdi, devc->device->commands, + return scpi_cmd(sdi, devc->device->commands, SCPI_CMD_SET_OVER_CURRENT_PROTECTION_THRESHOLD, d); break; case SR_CONF_OVER_TEMPERATURE_PROTECTION: if (g_variant_get_boolean(data)) - ret = scpi_cmd(sdi, devc->device->commands, + return scpi_cmd(sdi, devc->device->commands, SCPI_CMD_SET_OVER_TEMPERATURE_PROTECTION_ENABLE); else - ret = scpi_cmd(sdi, devc->device->commands, + return scpi_cmd(sdi, devc->device->commands, SCPI_CMD_SET_OVER_TEMPERATURE_PROTECTION_DISABLE); break; default: - ret = SR_ERR_NA; + return SR_ERR_NA; } - return ret; + return SR_OK; } -static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *cg) +static int config_list(uint32_t key, GVariant **data, + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; struct sr_channel *ch;