* @brief Reserve a set of GPIO lines, set the direction to input.
* @param bulk Set of GPIO lines to reserve.
* @param consumer Name of the consumer.
- * @param active_low Active state of the lines (true if low).
* @return 0 if the lines were properly reserved, -1 on failure.
*/
int gpiod_line_request_bulk_input(struct gpiod_line_bulk *bulk,
- const char *consumer,
- bool active_low) GPIOD_API;
+ const char *consumer) GPIOD_API;
/**
* @brief Reserve a set of GPIO lines, set the direction to output.
* @param bulk Set of GPIO lines to reserve.
* @param consumer Name of the consumer.
- * @param active_low Active state of the lines (true if low).
* @param default_vals Default line values.
* @return 0 if the lines were properly reserved, -1 on failure.
*/
int gpiod_line_request_bulk_output(struct gpiod_line_bulk *bulk,
- const char *consumer, bool active_low,
+ const char *consumer,
const int *default_vals) GPIOD_API;
+/**
+ * @brief Reserve a set of GPIO lines, set the direction to input.
+ * @param bulk Set of GPIO lines to reserve.
+ * @param consumer Name of the consumer.
+ * @param flags Additional request flags.
+ * @return 0 if the lines were properly reserved, -1 on failure.
+ */
+int gpiod_line_request_bulk_input_flags(struct gpiod_line_bulk *bulk,
+ const char *consumer,
+ int flags) GPIOD_API;
+
+/**
+ * @brief Reserve a set of GPIO lines, set the direction to output.
+ * @param bulk Set of GPIO lines to reserve.
+ * @param consumer Name of the consumer.
+ * @param flags Additional request flags.
+ * @param default_vals Default line values.
+ * @return 0 if the lines were properly reserved, -1 on failure.
+ */
+int gpiod_line_request_bulk_output_flags(struct gpiod_line_bulk *bulk,
+ const char *consumer, int flags,
+ const int *default_vals) GPIOD_API;
+
/**
* @brief Release a previously reserved line.
* @param line GPIO line object.
}
int gpiod_line_request_bulk_input(struct gpiod_line_bulk *bulk,
- const char *consumer, bool active_low)
+ const char *consumer)
{
struct gpiod_line_request_config config = {
.consumer = consumer,
.request_type = GPIOD_REQUEST_DIRECTION_INPUT,
- .flags = active_low ? GPIOD_REQUEST_ACTIVE_LOW : 0,
};
return gpiod_line_request_bulk(bulk, &config, 0);
}
int gpiod_line_request_bulk_output(struct gpiod_line_bulk *bulk,
- const char *consumer, bool active_low,
+ const char *consumer,
const int *default_vals)
{
struct gpiod_line_request_config config = {
.consumer = consumer,
.request_type = GPIOD_REQUEST_DIRECTION_OUTPUT,
- .flags = active_low ? GPIOD_REQUEST_ACTIVE_LOW: 0,
+ };
+
+ return gpiod_line_request_bulk(bulk, &config, default_vals);
+}
+
+int gpiod_line_request_bulk_input_flags(struct gpiod_line_bulk *bulk,
+ const char *consumer, int flags)
+{
+ struct gpiod_line_request_config config = {
+ .consumer = consumer,
+ .request_type = GPIOD_REQUEST_DIRECTION_INPUT,
+ .flags = flags,
+ };
+
+ return gpiod_line_request_bulk(bulk, &config, 0);
+}
+
+int gpiod_line_request_bulk_output_flags(struct gpiod_line_bulk *bulk,
+ const char *consumer, int flags,
+ const int *default_vals)
+{
+ struct gpiod_line_request_config config = {
+ .consumer = consumer,
+ .request_type = GPIOD_REQUEST_DIRECTION_OUTPUT,
+ .flags = flags,
};
return gpiod_line_request_bulk(bulk, &config, default_vals);
struct gpiod_line_bulk bulk;
struct gpiod_chip *chip;
struct gpiod_line *line;
+ int status, flags;
unsigned int i;
- int status;
if (num_lines > GPIOD_REQUEST_MAX_LINES) {
errno = EINVAL;
gpiod_line_bulk_add(&bulk, line);
}
- status = gpiod_line_request_bulk_input(&bulk, consumer, active_low);
+ flags = active_low ? GPIOD_REQUEST_ACTIVE_LOW : 0;
+
+ status = gpiod_line_request_bulk_input_flags(&bulk, consumer, flags);
if (status < 0) {
gpiod_chip_close(chip);
return -1;
struct gpiod_line_bulk bulk;
struct gpiod_chip *chip;
struct gpiod_line *line;
+ int status, flags;
unsigned int i;
- int status;
if (num_lines > GPIOD_REQUEST_MAX_LINES) {
errno = EINVAL;
gpiod_line_bulk_add(&bulk, line);
}
- status = gpiod_line_request_bulk_output(&bulk, consumer,
- active_low, values);
+ flags = active_low ? GPIOD_REQUEST_ACTIVE_LOW : 0;
+
+ status = gpiod_line_request_bulk_output_flags(&bulk, consumer,
+ flags, values);
if (status < 0) {
gpiod_chip_close(chip);
return -1;
valA[1] = 0;
valA[2] = 0;
valA[3] = 1;
- status = gpiod_line_request_bulk_output(&bulkA, TEST_CONSUMER,
- false, valA);
+ status = gpiod_line_request_bulk_output(&bulkA, TEST_CONSUMER, valA);
TEST_ASSERT_RET_OK(status);
valB[0] = 0;
valB[1] = 1;
valB[2] = 0;
valB[3] = 1;
- status = gpiod_line_request_bulk_output(&bulkB, TEST_CONSUMER,
- false, valB);
+ status = gpiod_line_request_bulk_output(&bulkB, TEST_CONSUMER, valB);
TEST_ASSERT_RET_OK(status);
memset(valA, 0, sizeof(valA));