]> sigrok.org Git - libsigrok.git/commitdiff
Add SR_CONF_INVERTED
authorMarc Schink <redacted>
Wed, 7 Feb 2024 15:15:31 +0000 (16:15 +0100)
committerSoeren Apel <redacted>
Mon, 19 Aug 2024 13:50:19 +0000 (15:50 +0200)
Many device such as oscilloscopes, signal and delay generators are
capable to invert signals or change their polarity.

Add a new configuration to implement such a feature. The term 'inverted'
is chosen in favor of 'polarity' because the former can be unambiguously
represented by a boolean value.

Signed-off-by: Marc Schink <redacted>
include/libsigrok/libsigrok.h
src/hwdriver.c

index 6c5dea08ab0d3ca3eeaa7fe45f1761876f1da353..c27bc1dd68a4da1997fd2b508efb4a292aca15d4 100644 (file)
@@ -1137,6 +1137,15 @@ enum sr_configkey {
         */
        SR_CONF_OVER_CURRENT_PROTECTION_DELAY,
 
+       /**
+        * Signal inversion.
+        * @arg type: boolean
+        * @arg get: @b true if the signal is inverted or has negative polarity,
+        *           @b false otherwise
+        * @arg set: set @b true to invert the signal
+        */
+       SR_CONF_INVERTED,
+
        /* Update sr_key_info_config[] (hwdriver.c) upon changes! */
 
        /*--- Special stuff -------------------------------------------------*/
index 068a215ac5f6956a4968e46566d2c3e7ce11b9d7..984ca0d0c93d549206f60eb46e9114f7e93c2afb 100644 (file)
@@ -216,6 +216,8 @@ static struct sr_key_info sr_key_info_config[] = {
                "Resistance Target", NULL},
        {SR_CONF_OVER_CURRENT_PROTECTION_DELAY, SR_T_FLOAT, "ocp_delay",
                "Over-current protection delay", NULL},
+       {SR_CONF_INVERTED, SR_T_BOOL, "inverted",
+               "Signal inverted", NULL},
 
        /* Special stuff */
        {SR_CONF_SESSIONFILE, SR_T_STRING, "sessionfile",