From: Marc Schink Date: Wed, 7 Feb 2024 15:15:31 +0000 (+0100) Subject: Add SR_CONF_INVERTED X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=2bc696a80342a05fb6e976f258d02a3a43f655f0;p=libsigrok.git Add SR_CONF_INVERTED 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 --- diff --git a/include/libsigrok/libsigrok.h b/include/libsigrok/libsigrok.h index 6c5dea08..c27bc1dd 100644 --- a/include/libsigrok/libsigrok.h +++ b/include/libsigrok/libsigrok.h @@ -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 -------------------------------------------------*/ diff --git a/src/hwdriver.c b/src/hwdriver.c index 068a215a..984ca0d0 100644 --- a/src/hwdriver.c +++ b/src/hwdriver.c @@ -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",