Revamp PPS-related config keys.
This commit is contained in:
parent
ca1a7cb56f
commit
a1eaa9e066
|
@ -661,29 +661,100 @@ enum sr_configkey {
|
|||
/** The device supports setting the number of analog channels. */
|
||||
SR_CONF_NUM_ANALOG_CHANNELS,
|
||||
|
||||
/** Output voltage. */
|
||||
/**
|
||||
* Output voltage.
|
||||
* @arg type: double
|
||||
* @arg get: get output voltage
|
||||
*/
|
||||
SR_CONF_OUTPUT_VOLTAGE,
|
||||
|
||||
/** Maximum output voltage. */
|
||||
/**
|
||||
* Maximum output voltage.
|
||||
* @arg type: double
|
||||
* @arg get: get maximum output voltage limit
|
||||
* @arg set: change output voltage limit
|
||||
*/
|
||||
SR_CONF_OUTPUT_VOLTAGE_MAX,
|
||||
|
||||
/** Output current. */
|
||||
/**
|
||||
* Output current.
|
||||
* @arg type: double
|
||||
* @arg get: get output current
|
||||
*/
|
||||
SR_CONF_OUTPUT_CURRENT,
|
||||
|
||||
/** Maximum output current. */
|
||||
/**
|
||||
* Maximum output current.
|
||||
* @arg type: double
|
||||
* @arg get: get maximum output voltage limit
|
||||
* @arg set: change output voltage limit
|
||||
*/
|
||||
SR_CONF_OUTPUT_CURRENT_MAX,
|
||||
|
||||
/** Enabling/disabling output. */
|
||||
/**
|
||||
* Enabling/disabling output.
|
||||
* @arg type: boolean
|
||||
* @arg get: @b true if currently enabled
|
||||
* @arg set: enable/disable
|
||||
*/
|
||||
SR_CONF_OUTPUT_ENABLED,
|
||||
|
||||
/** Channel output configuration. */
|
||||
SR_CONF_OUTPUT_CHANNEL,
|
||||
/**
|
||||
* Output channel configuration.
|
||||
* @arg type: string
|
||||
* @arg get: get current setting
|
||||
* @arg set: change current setting
|
||||
* @arg list: array of possible values
|
||||
*/
|
||||
SR_CONF_OUTPUT_CHANNEL_CONFIG,
|
||||
|
||||
/** Over-voltage protection (OVP) */
|
||||
SR_CONF_OVER_VOLTAGE_PROTECTION,
|
||||
/**
|
||||
* Over-voltage protection (OVP) feature
|
||||
* @arg type: boolean
|
||||
* @arg get: @b true if currently enabled
|
||||
* @arg set: enable/disable
|
||||
*/
|
||||
SR_CONF_OVER_VOLTAGE_PROTECTION_ENABLED,
|
||||
|
||||
/** Over-current protection (OCP) */
|
||||
SR_CONF_OVER_CURRENT_PROTECTION,
|
||||
/**
|
||||
* Over-voltage protection (OVP) active
|
||||
* @arg type: boolean
|
||||
* @arg get: @b true if device has activated OVP, i.e. the output voltage
|
||||
* exceeds the over-voltage protection threshold.
|
||||
*/
|
||||
SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE,
|
||||
|
||||
/**
|
||||
* Over-voltage protection (OVP) threshold
|
||||
* @arg type: double (voltage)
|
||||
* @arg get: get current threshold
|
||||
* @arg set: set new threshold
|
||||
*/
|
||||
SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD,
|
||||
|
||||
/**
|
||||
* Over-current protection (OCP) feature
|
||||
* @arg type: boolean
|
||||
* @arg get: @b true if currently enabled
|
||||
* @arg set: enable/disable
|
||||
*/
|
||||
SR_CONF_OVER_CURRENT_PROTECTION_ENABLED,
|
||||
|
||||
/**
|
||||
* Over-current protection (OCP) active
|
||||
* @arg type: boolean
|
||||
* @arg get: @b true if device has activated OCP, i.e. the output current
|
||||
* exceeds the over-current protection threshold.
|
||||
*/
|
||||
SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE,
|
||||
|
||||
/**
|
||||
* Over-current protection (OCP) threshold
|
||||
* @arg type: double (current)
|
||||
* @arg get: get current threshold
|
||||
* @arg set: set new threshold
|
||||
*/
|
||||
SR_CONF_OVER_CURRENT_PROTECTION_THRESHOLD,
|
||||
|
||||
/** Choice of clock edge for external clock ("r" or "f"). */
|
||||
SR_CONF_CLOCK_EDGE,
|
||||
|
@ -691,6 +762,16 @@ enum sr_configkey {
|
|||
/** Amplitude of a source without strictly-defined MQ. */
|
||||
SR_CONF_AMPLITUDE,
|
||||
|
||||
/**
|
||||
* Output channel regulation
|
||||
* get: "CV", "CC" or "UR", denoting constant voltage, constant current
|
||||
* or unregulated.
|
||||
*/
|
||||
SR_CONF_OUTPUT_REGULATION,
|
||||
|
||||
/** Over-temperature protection (OTP) */
|
||||
SR_CONF_OVER_TEMPERATURE_PROTECTION,
|
||||
|
||||
/*--- Special stuff -------------------------------------------------*/
|
||||
|
||||
/** Scan options supported by the driver. */
|
||||
|
|
|
@ -39,8 +39,8 @@ static const int32_t scanopts[] = {
|
|||
static const int32_t devopts[] = {
|
||||
SR_CONF_POWER_SUPPLY,
|
||||
SR_CONF_CONTINUOUS,
|
||||
SR_CONF_OUTPUT_CHANNEL,
|
||||
SR_CONF_OVER_CURRENT_PROTECTION,
|
||||
SR_CONF_OUTPUT_CHANNEL_CONFIG,
|
||||
SR_CONF_OVER_CURRENT_PROTECTION_ENABLED,
|
||||
};
|
||||
|
||||
static const int32_t devopts_cg[] = {
|
||||
|
@ -221,10 +221,10 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
|||
if (!cg) {
|
||||
/* No channel group: global options. */
|
||||
switch (key) {
|
||||
case SR_CONF_OUTPUT_CHANNEL:
|
||||
case SR_CONF_OUTPUT_CHANNEL_CONFIG:
|
||||
*data = g_variant_new_string(channel_modes[devc->channel_mode]);
|
||||
break;
|
||||
case SR_CONF_OVER_CURRENT_PROTECTION:
|
||||
case SR_CONF_OVER_CURRENT_PROTECTION_ENABLED:
|
||||
*data = g_variant_new_boolean(devc->over_current_protection);
|
||||
break;
|
||||
default:
|
||||
|
@ -292,7 +292,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
|||
if (!cg) {
|
||||
/* No channel group: global options. */
|
||||
switch (key) {
|
||||
case SR_CONF_OUTPUT_CHANNEL:
|
||||
case SR_CONF_OUTPUT_CHANNEL_CONFIG:
|
||||
sval = g_variant_get_string(data, NULL);
|
||||
if ((ival = find_str(sval, channel_modes,
|
||||
ARRAY_SIZE(channel_modes))) == -1) {
|
||||
|
@ -309,7 +309,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
|||
devc->channel_mode_set = ival;
|
||||
devc->config_dirty = TRUE;
|
||||
break;
|
||||
case SR_CONF_OVER_CURRENT_PROTECTION:
|
||||
case SR_CONF_OVER_CURRENT_PROTECTION_ENABLED:
|
||||
bval = g_variant_get_boolean(data);
|
||||
if (bval == devc->over_current_protection_set)
|
||||
/* Nothing to do. */
|
||||
|
@ -386,7 +386,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
|||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||
devopts, ARRAY_SIZE(devopts), sizeof(int32_t));
|
||||
break;
|
||||
case SR_CONF_OUTPUT_CHANNEL:
|
||||
case SR_CONF_OUTPUT_CHANNEL_CONFIG:
|
||||
if (devc->model->channel_modes == CHANMODE_INDEPENDENT) {
|
||||
/* The 1-channel models. */
|
||||
*data = g_variant_new_strv(channel_modes, 1);
|
||||
|
|
|
@ -36,7 +36,7 @@ static const int32_t hwcaps[] = {
|
|||
SR_CONF_OUTPUT_VOLTAGE,
|
||||
SR_CONF_OUTPUT_CURRENT,
|
||||
/* There's no SR_CONF_OUTPUT_ENABLED; can't know/set status remotely. */
|
||||
SR_CONF_OVER_CURRENT_PROTECTION,
|
||||
SR_CONF_OVER_CURRENT_PROTECTION_ENABLED,
|
||||
};
|
||||
|
||||
SR_PRIV struct sr_dev_driver conrad_digi_35_cpu_driver_info;
|
||||
|
@ -151,7 +151,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
|||
ret = send_msg1(sdi, 'C', (int) (dblval * 100 + 0.5));
|
||||
break;
|
||||
/* No SR_CONF_OUTPUT_ENABLED :-( . */
|
||||
case SR_CONF_OVER_CURRENT_PROTECTION:
|
||||
case SR_CONF_OVER_CURRENT_PROTECTION_ENABLED:
|
||||
if (g_variant_get_boolean(data))
|
||||
ret = send_msg1(sdi, 'V', 900);
|
||||
else /* Constant current mode */
|
||||
|
|
|
@ -58,7 +58,7 @@ static const int32_t hwcaps[] = {
|
|||
SR_CONF_LIMIT_MSEC,
|
||||
SR_CONF_CONTINUOUS,
|
||||
/* Device configuration */
|
||||
SR_CONF_OUTPUT_CHANNEL,
|
||||
SR_CONF_OUTPUT_CHANNEL_CONFIG,
|
||||
};
|
||||
|
||||
/** Hardware capabilities channel 1, 2. */
|
||||
|
@ -561,7 +561,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
|||
case SR_CONF_LIMIT_MSEC:
|
||||
*data = g_variant_new_uint64(devc->limit_msec);
|
||||
break;
|
||||
case SR_CONF_OUTPUT_CHANNEL:
|
||||
case SR_CONF_OUTPUT_CHANNEL_CONFIG:
|
||||
*data = g_variant_new_string(channel_modes[devc->tracking_mode]);
|
||||
break;
|
||||
default:
|
||||
|
@ -634,7 +634,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
|
|||
sr_dbg("Setting sample limit to %" PRIu64 ".",
|
||||
devc->limit_samples);
|
||||
break;
|
||||
case SR_CONF_OUTPUT_CHANNEL:
|
||||
case SR_CONF_OUTPUT_CHANNEL_CONFIG:
|
||||
sval = g_variant_get_string(data, NULL);
|
||||
found = FALSE;
|
||||
for (idx = 0; idx < (int)ARRAY_SIZE(channel_modes); idx++)
|
||||
|
@ -748,7 +748,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
|
|||
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
|
||||
hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t));
|
||||
return SR_OK;
|
||||
case SR_CONF_OUTPUT_CHANNEL:
|
||||
case SR_CONF_OUTPUT_CHANNEL_CONFIG:
|
||||
if (devc->model->modelid <= LPS_303) {
|
||||
/* The 1-channel models. */
|
||||
*data = g_variant_new_strv(channel_modes, 1);
|
||||
|
|
|
@ -114,18 +114,30 @@ static struct sr_config_info sr_config_info_data[] = {
|
|||
"Maximum output current", NULL},
|
||||
{SR_CONF_OUTPUT_ENABLED, SR_T_BOOL, "output_enabled",
|
||||
"Output enabled", NULL},
|
||||
{SR_CONF_OUTPUT_CHANNEL, SR_T_STRING, "output_channel",
|
||||
{SR_CONF_OUTPUT_CHANNEL_CONFIG, SR_T_STRING, "output_channel_config",
|
||||
"Output channel modes", NULL},
|
||||
{SR_CONF_OVER_VOLTAGE_PROTECTION, SR_T_BOOL, "ovp",
|
||||
"Over-voltage protection", NULL},
|
||||
{SR_CONF_OVER_CURRENT_PROTECTION, SR_T_BOOL, "ocp",
|
||||
"Over-current protection", NULL},
|
||||
{SR_CONF_OVER_VOLTAGE_PROTECTION_ENABLED, SR_T_BOOL, "ovp_enabled",
|
||||
"Over-voltage protection enabled", NULL},
|
||||
{SR_CONF_OVER_VOLTAGE_PROTECTION_ACTIVE, SR_T_BOOL, "ovp_active",
|
||||
"Over-voltage protection active", NULL},
|
||||
{SR_CONF_OVER_VOLTAGE_PROTECTION_THRESHOLD, SR_T_FLOAT, "ovp_threshold",
|
||||
"Over-voltage protection threshold", NULL},
|
||||
{SR_CONF_OVER_CURRENT_PROTECTION_ENABLED, SR_T_BOOL, "ocp_enabled",
|
||||
"Over-current protection enabled", NULL},
|
||||
{SR_CONF_OVER_CURRENT_PROTECTION_ACTIVE, SR_T_BOOL, "ocp_active",
|
||||
"Over-current protection active", NULL},
|
||||
{SR_CONF_OVER_CURRENT_PROTECTION_THRESHOLD, SR_T_FLOAT, "ocp_threshold",
|
||||
"Over-current protection threshold", NULL},
|
||||
{SR_CONF_LIMIT_SAMPLES, SR_T_UINT64, "limit_samples",
|
||||
"Sample limit", NULL},
|
||||
{SR_CONF_CLOCK_EDGE, SR_T_STRING, "clock_edge",
|
||||
"Clock edge", NULL},
|
||||
{SR_CONF_AMPLITUDE, SR_T_FLOAT, "amplitude",
|
||||
"Amplitude", NULL},
|
||||
{SR_CONF_OVER_TEMPERATURE_PROTECTION, SR_T_BOOL, "otp",
|
||||
"Over-temperature protection", NULL},
|
||||
{SR_CONF_OUTPUT_REGULATION, SR_T_STRING, "output_regulation",
|
||||
"Output channel regulation", NULL},
|
||||
{0, 0, NULL, NULL, NULL},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue