int gpiod_line_request_output(struct gpiod_line *line, const char *consumer,
bool active_low, int default_val) GPIOD_API;
+/**
+ * @brief Request rising edge event notifications on a single line.
+ * @param line GPIO line object.
+ * @param consumer Name of the consumer.
+ * @param active_low Active state of the line - true if low.
+ * @return 0 if the operation succeeds, -1 on failure.
+ */
+int gpiod_line_request_rising_edge_events(struct gpiod_line *line,
+ const char *consumer,
+ bool active_low) GPIOD_API;
+
+/**
+ * @brief Request falling edge event notifications on a single line.
+ * @param line GPIO line object.
+ * @param consumer Name of the consumer.
+ * @param active_low Active state of the line - true if low.
+ * @return 0 if the operation succeeds, -1 on failure.
+ */
+int gpiod_line_request_falling_edge_events(struct gpiod_line *line,
+ const char *consumer,
+ bool active_low) GPIOD_API;
+
+/**
+ * @brief Request all event type notifications on a single line.
+ * @param line GPIO line object.
+ * @param consumer Name of the consumer.
+ * @param active_low Active state of the line - true if low.
+ * @return 0 if the operation succeeds, -1 on failure.
+ */
+int gpiod_line_request_both_edges_events(struct gpiod_line *line,
+ const char *consumer,
+ bool active_low) GPIOD_API;
+
/**
* @brief Reserve a set of GPIO lines.
* @param bulk Set of GPIO lines to reserve.
/**< Type of the event that occurred. */
};
-/**
- * @brief Request rising edge event notifications on a single line.
- * @param line GPIO line object.
- * @param consumer Name of the consumer.
- * @param active_low Active state of the line - true if low.
- * @return 0 if the operation succeeds, -1 on failure.
- */
-int gpiod_line_event_request_rising(struct gpiod_line *line,
- const char *consumer,
- bool active_low) GPIOD_API;
-
-/**
- * @brief Request falling edge event notifications on a single line.
- * @param line GPIO line object.
- * @param consumer Name of the consumer.
- * @param active_low Active state of the line - true if low.
- * @return 0 if the operation succeeds, -1 on failure.
- */
-int gpiod_line_event_request_falling(struct gpiod_line *line,
- const char *consumer,
- bool active_low) GPIOD_API;
-
-/**
- * @brief Request all event type notifications on a single line.
- * @param line GPIO line object.
- * @param consumer Name of the consumer.
- * @param active_low Active state of the line - true if low.
- * @return 0 if the operation succeeds, -1 on failure.
- */
-int gpiod_line_event_request_both(struct gpiod_line *line,
- const char *consumer,
- bool active_low) GPIOD_API;
-
/**
* @brief Wait for an event on a single line.
* @param line GPIO line object.
return gpiod_line_request(line, &config, 0);
}
-int gpiod_line_event_request_rising(struct gpiod_line *line,
- const char *consumer, bool active_low)
+int gpiod_line_request_rising_edge_events(struct gpiod_line *line,
+ const char *consumer,
+ bool active_low)
{
return line_event_request_type(line, consumer, active_low,
GPIOD_REQUEST_EVENT_RISING_EDGE);
}
-int gpiod_line_event_request_falling(struct gpiod_line *line,
- const char *consumer, bool active_low)
+int gpiod_line_request_falling_edge_events(struct gpiod_line *line,
+ const char *consumer,
+ bool active_low)
{
return line_event_request_type(line, consumer, active_low,
GPIOD_REQUEST_EVENT_FALLING_EDGE);
}
-int gpiod_line_event_request_both(struct gpiod_line *line,
- const char *consumer, bool active_low)
+int gpiod_line_request_both_edges_events(struct gpiod_line *line,
+ const char *consumer, bool active_low)
{
return line_event_request_type(line, consumer, active_low,
GPIOD_REQUEST_EVENT_BOTH_EDGES);
struct timespec ts = { 1, 0 };
struct gpiod_line_event ev;
struct gpiod_line *line;
- int status;
+ int rv;
chip = gpiod_chip_open(test_chip_path(0));
TEST_ASSERT_NOT_NULL(chip);
line = gpiod_chip_get_line(chip, 7);
TEST_ASSERT_NOT_NULL(line);
- status = gpiod_line_event_request_rising(line, TEST_CONSUMER, false);
- TEST_ASSERT_RET_OK(status);
+ rv = gpiod_line_request_rising_edge_events(line, TEST_CONSUMER, false);
+ TEST_ASSERT_RET_OK(rv);
test_set_event(0, 7, TEST_EVENT_RISING, 100);
- status = gpiod_line_event_wait(line, &ts);
- TEST_ASSERT_EQ(status, 1);
+ rv = gpiod_line_event_wait(line, &ts);
+ TEST_ASSERT_EQ(rv, 1);
- status = gpiod_line_event_read(line, &ev);
- TEST_ASSERT_RET_OK(status);
+ rv = gpiod_line_event_read(line, &ev);
+ TEST_ASSERT_RET_OK(rv);
TEST_ASSERT_EQ(ev.event_type, GPIOD_EVENT_RISING_EDGE);
}
struct timespec ts = { 1, 0 };
struct gpiod_line_event ev;
struct gpiod_line *line;
- int status;
+ int rv;
chip = gpiod_chip_open(test_chip_path(0));
TEST_ASSERT_NOT_NULL(chip);
line = gpiod_chip_get_line(chip, 7);
TEST_ASSERT_NOT_NULL(line);
- status = gpiod_line_event_request_falling(line, TEST_CONSUMER, false);
- TEST_ASSERT_RET_OK(status);
+ rv = gpiod_line_request_falling_edge_events(line,
+ TEST_CONSUMER, false);
+ TEST_ASSERT_RET_OK(rv);
test_set_event(0, 7, TEST_EVENT_FALLING, 100);
- status = gpiod_line_event_wait(line, &ts);
- TEST_ASSERT_EQ(status, 1);
+ rv = gpiod_line_event_wait(line, &ts);
+ TEST_ASSERT_EQ(rv, 1);
- status = gpiod_line_event_read(line, &ev);
- TEST_ASSERT_RET_OK(status);
+ rv = gpiod_line_event_read(line, &ev);
+ TEST_ASSERT_RET_OK(rv);
TEST_ASSERT_EQ(ev.event_type, GPIOD_EVENT_FALLING_EDGE);
}
TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
struct timespec ts = { 0, 300 };
struct gpiod_line *line;
- int status;
+ int rv;
chip = gpiod_chip_open(test_chip_path(0));
TEST_ASSERT_NOT_NULL(chip);
line = gpiod_chip_get_line(chip, 7);
TEST_ASSERT_NOT_NULL(line);
- status = gpiod_line_event_request_rising(line, TEST_CONSUMER, false);
- TEST_ASSERT_RET_OK(status);
+ rv = gpiod_line_request_rising_edge_events(line, TEST_CONSUMER, false);
+ TEST_ASSERT_RET_OK(rv);
test_set_event(0, 7, TEST_EVENT_FALLING, 100);
- status = gpiod_line_event_wait(line, &ts);
- TEST_ASSERT_EQ(status, 0);
+ rv = gpiod_line_event_wait(line, &ts);
+ TEST_ASSERT_EQ(rv, 0);
}
TEST_DEFINE(event_rising_edge_ignore_falling,
"events - request rising edge & ignore falling edge events",
struct timespec ts = { 1, 0 };
struct gpiod_line_event ev;
struct gpiod_line *line;
- int status;
+ int rv;
chip = gpiod_chip_open(test_chip_path(0));
TEST_ASSERT_NOT_NULL(chip);
line = gpiod_chip_get_line(chip, 7);
TEST_ASSERT_NOT_NULL(line);
- status = gpiod_line_event_request_rising(line, TEST_CONSUMER, true);
- TEST_ASSERT_RET_OK(status);
+ rv = gpiod_line_request_rising_edge_events(line, TEST_CONSUMER, true);
+ TEST_ASSERT_RET_OK(rv);
test_set_event(0, 7, TEST_EVENT_RISING, 100);
- status = gpiod_line_event_wait(line, &ts);
- TEST_ASSERT_EQ(status, 1);
+ rv = gpiod_line_event_wait(line, &ts);
+ TEST_ASSERT_EQ(rv, 1);
- status = gpiod_line_event_read(line, &ev);
- TEST_ASSERT_RET_OK(status);
+ rv = gpiod_line_event_read(line, &ev);
+ TEST_ASSERT_RET_OK(rv);
TEST_ASSERT_EQ(ev.event_type, GPIOD_EVENT_RISING_EDGE);
}
struct timespec ts = { 1, 0 };
struct gpiod_line_event ev;
struct gpiod_line *line;
- int status;
+ int rv;
chip = gpiod_chip_open(test_chip_path(0));
TEST_ASSERT_NOT_NULL(chip);
line = gpiod_chip_get_line(chip, 7);
TEST_ASSERT_NOT_NULL(line);
- status = gpiod_line_event_request_rising(line, TEST_CONSUMER, false);
- TEST_ASSERT_RET_OK(status);
+ rv = gpiod_line_request_rising_edge_events(line, TEST_CONSUMER, false);
+ TEST_ASSERT_RET_OK(rv);
- status = gpiod_line_get_value(line);
- TEST_ASSERT_EQ(status, 0);
+ rv = gpiod_line_get_value(line);
+ TEST_ASSERT_EQ(rv, 0);
test_set_event(0, 7, TEST_EVENT_RISING, 100);
- status = gpiod_line_event_wait(line, &ts);
- TEST_ASSERT_EQ(status, 1);
+ rv = gpiod_line_event_wait(line, &ts);
+ TEST_ASSERT_EQ(rv, 1);
- status = gpiod_line_event_read(line, &ev);
- TEST_ASSERT_RET_OK(status);
+ rv = gpiod_line_event_read(line, &ev);
+ TEST_ASSERT_RET_OK(rv);
TEST_ASSERT_EQ(ev.event_type, GPIOD_EVENT_RISING_EDGE);
- status = gpiod_line_get_value(line);
- TEST_ASSERT_EQ(status, 1);
+ rv = gpiod_line_get_value(line);
+ TEST_ASSERT_EQ(rv, 1);
}
TEST_DEFINE(event_get_value,
"events - mixing events and gpiod_line_get_value()",