: GPIOD_DIRECTION_INPUT;
}
-int gpiod_line_polarity(struct gpiod_line *line)
+int gpiod_line_active_state(struct gpiod_line *line)
{
return line->info.flags & GPIOLINE_FLAG_ACTIVE_LOW
- ? GPIOD_POLARITY_ACTIVE_LOW
- : GPIOD_POLARITY_ACTIVE_HIGH;
+ ? GPIOD_ACTIVE_STATE_LOW
+ : GPIOD_ACTIVE_STATE_HIGH;
}
bool gpiod_line_is_used_by_kernel(struct gpiod_line *line)
else if (config->direction == GPIOD_DIRECTION_OUTPUT)
req->flags |= GPIOHANDLE_REQUEST_OUTPUT;
- if (config->polarity == GPIOD_POLARITY_ACTIVE_LOW)
+ if (config->active_state == GPIOD_ACTIVE_STATE_LOW)
req->flags |= GPIOHANDLE_REQUEST_ACTIVE_LOW;
req->lines = line_bulk->num_lines;
if (config->line_flags & GPIOD_REQUEST_OPEN_SOURCE)
req->handleflags |= GPIOHANDLE_REQUEST_OPEN_SOURCE;
- if (config->polarity == GPIOD_POLARITY_ACTIVE_LOW)
+ if (config->active_state == GPIOD_ACTIVE_STATE_LOW)
req->handleflags |= GPIOHANDLE_REQUEST_ACTIVE_LOW;
if (config->event_type == GPIOD_EVENT_RISING_EDGE)
};
/**
- * @brief Available polarity settings.
+ * @brief Available active state settings.
*/
enum {
- GPIOD_POLARITY_ACTIVE_HIGH,
- /**< The polarity of a GPIO is active-high. */
- GPIOD_POLARITY_ACTIVE_LOW,
- /**< The polarity of a GPIO is active-low. */
+ GPIOD_ACTIVE_STATE_HIGH,
+ /**< The active state of a GPIO is active-high. */
+ GPIOD_ACTIVE_STATE_LOW,
+ /**< The active state of a GPIO is active-low. */
};
/**
int gpiod_line_direction(struct gpiod_line *line) GPIOD_API;
/**
- * @brief Read the GPIO line polarity setting.
+ * @brief Read the GPIO line active state setting.
* @param line GPIO line object.
- * @return Returns GPIOD_POLARITY_ACTIVE_HIGH or GPIOD_POLARITY_ACTIVE_LOW.
+ * @return Returns GPIOD_ACTIVE_STATE_HIGH or GPIOD_ACTIVE_STATE_LOW.
*/
-int gpiod_line_polarity(struct gpiod_line *line) GPIOD_API;
+int gpiod_line_active_state(struct gpiod_line *line) GPIOD_API;
/**
* @brief Check if the line is used by the kernel.
/**< Name of the consumer. */
int direction;
/**< Requested direction. */
- int polarity;
- /**< Requested polarity configuration. */
+ int active_state;
+ /**< Requested active state configuration. */
int flags;
/**< Other configuration flags. */
};
/**< Name of the consumer. */
int event_type;
/**< Type of the event we want to be notified about. */
- int polarity;
- /**< GPIO line polarity. */
+ int active_state;
+ /**< GPIO line active state. */
int line_flags;
/**< Misc line flags - same as for line requests. */
};
int main(int argc, char **argv)
{
- int i, direction, flag_printed, polarity;
+ int i, direction, flag_printed, active_state;
struct gpiod_line_iter iter;
const char *name, *consumer;
struct gpiod_line *line;
name = gpiod_line_name(line);
consumer = gpiod_line_consumer(line);
direction = gpiod_line_direction(line);
- polarity = gpiod_line_polarity(line);
+ active_state = gpiod_line_active_state(line);
printf("\tline %2u: ", gpiod_line_offset(line));
printf("%s ", direction == GPIOD_DIRECTION_INPUT
? "input" : "output");
- printf("%s ", polarity == GPIOD_POLARITY_ACTIVE_LOW
+ printf("%s ", active_state == GPIOD_ACTIVE_STATE_LOW
? "active-low"
: "active-high");