[libgpiod v2][PATCH v3 1/3] API: add an enum for line values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In order to explicitly stress that line values as understood by libgpiod
are logical values, expose a two-value enum with values called: ACTIVE
and INACTIVE that should be used whenever referring to the state of GPIO
lines.

The value of INACTIVE is set to 0 while that of ACTIVE to 1 so that users
can still use integers in C (where no scoped enums exist).

Signed-off-by: Bartosz Golaszewski <brgl@xxxxxxxx>
---
 include/gpiod.h | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/gpiod.h b/include/gpiod.h
index 074e395..34fdad6 100644
--- a/include/gpiod.h
+++ b/include/gpiod.h
@@ -185,12 +185,20 @@ gpiod_chip_request_lines(struct gpiod_chip *chip,
 /**
  * @}
  *
- * @defgroup line_settings Line settings
+ * @defgroup line_settings Line definitions
  * @{
  *
- * These defines are used both by gpiod_line_info and gpiod_line_config.
+ * These defines are used across the API.
  */
 
+/**
+ * @brief Logical line state.
+ */
+enum {
+	GPIOD_LINE_VALUE_INACTIVE = 0,
+	GPIOD_LINE_VALUE_ACTIVE = 1,
+};
+
 /**
  * @brief Direction settings.
  */
-- 
2.30.1




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux