/**< Only watch falling edge events. */
};
-/**
- * @brief Available active states for line requests.
- */
-enum {
- GPIOD_REQUEST_ACTIVE_HIGH,
- /**< Request the line(s) with active-high state. */
- GPIOD_REQUEST_ACTIVE_LOW,
- /**< Request the line(s) with active-low state. */
-};
-
/**
* @brief Miscellaneous GPIO flags.
*/
/**< The line is an open-drain port. */
GPIOD_REQUEST_OPEN_SOURCE = GPIOD_BIT(1),
/**< The line is an open-source port. */
+ GPIOD_REQUEST_ACTIVE_LOW = GPIOD_BIT(2),
+ /**< The active state of the line is low (high is the default). */
};
/**
/**< Name of the consumer. */
int request_type;
/**< Request type. */
- int active_state;
- /**< Requested active state configuration. */
int flags;
/**< Other configuration flags. */
};
struct gpiod_line_request_config config = {
.consumer = consumer,
.request_type = GPIOD_REQUEST_DIRECTION_INPUT,
- .active_state = active_low ? GPIOD_REQUEST_ACTIVE_LOW
- : GPIOD_REQUEST_ACTIVE_HIGH,
+ .flags = active_low ? GPIOD_REQUEST_ACTIVE_LOW : 0,
};
return gpiod_line_request(line, &config, 0);
struct gpiod_line_request_config config = {
.consumer = consumer,
.request_type = GPIOD_REQUEST_DIRECTION_OUTPUT,
- .active_state = active_low ? GPIOD_REQUEST_ACTIVE_LOW
- : GPIOD_REQUEST_ACTIVE_HIGH,
+ .flags = active_low ? GPIOD_REQUEST_ACTIVE_LOW : 0,
};
return gpiod_line_request(line, &config, default_val);
req->flags |= GPIOHANDLE_REQUEST_OPEN_DRAIN;
if (config->flags & GPIOD_REQUEST_OPEN_SOURCE)
req->flags |= GPIOHANDLE_REQUEST_OPEN_SOURCE;
+ if (config->flags & GPIOD_REQUEST_ACTIVE_LOW)
+ req->flags |= GPIOHANDLE_REQUEST_ACTIVE_LOW;
if (config->request_type == GPIOD_REQUEST_DIRECTION_INPUT)
req->flags |= GPIOHANDLE_REQUEST_INPUT;
else if (config->request_type == GPIOD_REQUEST_DIRECTION_OUTPUT)
req->flags |= GPIOHANDLE_REQUEST_OUTPUT;
- if (config->active_state == GPIOD_REQUEST_ACTIVE_LOW) {
- req->flags |= GPIOHANDLE_REQUEST_ACTIVE_LOW;
- } else if (config->active_state != GPIOD_REQUEST_ACTIVE_HIGH) {
- errno = EINVAL;
- return -1;
- }
-
req->lines = bulk->num_lines;
for (i = 0; i < bulk->num_lines; i++) {
req->handleflags |= GPIOHANDLE_REQUEST_OPEN_DRAIN;
if (config->flags & GPIOD_REQUEST_OPEN_SOURCE)
req->handleflags |= GPIOHANDLE_REQUEST_OPEN_SOURCE;
-
- if (config->active_state == GPIOD_REQUEST_ACTIVE_LOW) {
+ if (config->flags & GPIOD_REQUEST_ACTIVE_LOW)
req->handleflags |= GPIOHANDLE_REQUEST_ACTIVE_LOW;
- } else if (config->active_state != GPIOD_REQUEST_ACTIVE_HIGH) {
- errno = EINVAL;
- return -1;
- }
if (config->request_type == GPIOD_REQUEST_EVENT_RISING_EDGE)
req->eventflags |= GPIOEVENT_REQUEST_RISING_EDGE;
struct gpiod_line_request_config config = {
.consumer = consumer,
.request_type = GPIOD_REQUEST_DIRECTION_INPUT,
- .active_state = active_low ? GPIOD_REQUEST_ACTIVE_LOW
- : GPIOD_REQUEST_ACTIVE_HIGH,
+ .flags = active_low ? GPIOD_REQUEST_ACTIVE_LOW : 0,
};
return gpiod_line_request_bulk(bulk, &config, 0);
struct gpiod_line_request_config config = {
.consumer = consumer,
.request_type = GPIOD_REQUEST_DIRECTION_OUTPUT,
- .active_state = active_low ? GPIOD_REQUEST_ACTIVE_LOW
- : GPIOD_REQUEST_ACTIVE_HIGH,
+ .flags = active_low ? GPIOD_REQUEST_ACTIVE_LOW: 0,
};
return gpiod_line_request_bulk(bulk, &config, default_vals);
struct gpiod_line_request_config config = {
.consumer = consumer,
.request_type = type,
- .active_state = active_low ? GPIOD_REQUEST_ACTIVE_LOW
- : GPIOD_REQUEST_ACTIVE_HIGH,
+ .flags = active_low ? GPIOD_REQUEST_ACTIVE_LOW : 0,
};
return gpiod_line_request(line, &config, 0);
req.consumer = TEST_CONSUMER;
req.request_type = GPIOD_REQUEST_DIRECTION_INPUT;
- req.active_state = GPIOD_ACTIVE_STATE_HIGH;
+ req.flags = GPIOD_ACTIVE_STATE_HIGH;
status = gpiod_line_request_bulk(&bulk, &req, NULL);
TEST_ASSERT_NOTEQ(status, 0);
config.request_type = GPIOD_REQUEST_DIRECTION_INPUT;
config.consumer = TEST_CONSUMER;
- config.active_state = GPIOD_REQUEST_ACTIVE_HIGH;
config.flags = GPIOD_REQUEST_OPEN_DRAIN;
status = gpiod_line_request(line, &config, 0);
config.request_type = GPIOD_REQUEST_DIRECTION_INPUT;
config.consumer = NULL;
- config.active_state = GPIOD_REQUEST_ACTIVE_HIGH;
config.flags = 0;
rv = gpiod_line_request(line, &config, 0);
config.request_type = GPIOD_REQUEST_DIRECTION_INPUT;
config.consumer = "";
- config.active_state = GPIOD_REQUEST_ACTIVE_HIGH;
config.flags = 0;
rv = gpiod_line_request(line, &config, 0);