]> sigrok.org Git - libsigrok.git/commitdiff
Revamp PPS-related config keys.
authorBert Vermeulen <redacted>
Fri, 5 Sep 2014 00:47:22 +0000 (02:47 +0200)
committerBert Vermeulen <redacted>
Mon, 8 Sep 2014 10:45:21 +0000 (12:45 +0200)
include/libsigrok/libsigrok.h
src/hardware/atten-pps3xxx/api.c
src/hardware/conrad-digi-35-cpu/api.c
src/hardware/motech-lps-30x/api.c
src/hwdriver.c

index cadb88e881f1913723511fb14688ae7a9a224ac2..5c04221611825240a1b7ecc33abaf6f1a40bf6a9 100644 (file)
@@ -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) feature
+        * @arg type: boolean
+        * @arg get: @b true if currently enabled
+        * @arg set: enable/disable
+        */
+       SR_CONF_OVER_VOLTAGE_PROTECTION_ENABLED,
+
+       /**
+        * 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-voltage protection (OVP) */
-       SR_CONF_OVER_VOLTAGE_PROTECTION,
+       /**
+        * 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) */
-       SR_CONF_OVER_CURRENT_PROTECTION,
+       /**
+        * 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. */
index 5ca3dbe99dc9fece512c1c8afbf96a1f7f5930e2..b6eae3cc776a979e0fa4871bd8fa52bcaf7593f4 100644 (file)
@@ -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);
index 01adcef8ab2fec517fb322b0024d5ce5dd991122..6a1f31c9a952d1777d23094f0ae4d10bce36d7d2 100644 (file)
@@ -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 */
index 164a9cc02321d88656018a93e0879cf765f6dc17..ae08317a0ae4348520669ab4de61fd5ade5d9e5a 100644 (file)
@@ -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);
index 914fc337cf79e3474b42d7d851e4e18660e00c7e..8cd9cdea736b068b4f09e41a0134c318be7f7bad 100644 (file)
@@ -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},
 };