REQUIRE(line.consumer().empty());
REQUIRE_FALSE(line.is_requested());
REQUIRE_FALSE(line.is_used());
+ REQUIRE_FALSE(line.is_open_drain());
+ REQUIRE_FALSE(line.is_open_source());
+ REQUIRE(line.bias() == ::gpiod::line::BIAS_AS_IS);
}
SECTION("exported line")
REQUIRE(line.active_state() == ::gpiod::line::ACTIVE_HIGH);
REQUIRE(line.is_requested());
REQUIRE(line.is_used());
+ REQUIRE_FALSE(line.is_open_drain());
+ REQUIRE_FALSE(line.is_open_source());
+ REQUIRE(line.bias() == ::gpiod::line::BIAS_AS_IS);
}
SECTION("exported line with flags")
REQUIRE(line.is_used());
REQUIRE(line.is_open_drain());
REQUIRE_FALSE(line.is_open_source());
+ REQUIRE(line.bias() == ::gpiod::line::BIAS_AS_IS);
+ }
+
+ SECTION("exported open source line")
+ {
+ ::gpiod::line_request config;
+
+ config.consumer = consumer.c_str();
+ config.request_type = ::gpiod::line_request::DIRECTION_OUTPUT;
+ config.flags = ::gpiod::line_request::FLAG_OPEN_SOURCE;
+ line.request(config);
+
+ REQUIRE(line.offset() == 4);
+ REQUIRE(line.name() == "gpio-mockup-A-4");
+ REQUIRE(line.direction() == ::gpiod::line::DIRECTION_OUTPUT);
+ REQUIRE(line.active_state() == ::gpiod::line::ACTIVE_HIGH);
+ REQUIRE(line.is_requested());
+ REQUIRE(line.is_used());
+ REQUIRE_FALSE(line.is_open_drain());
+ REQUIRE(line.is_open_source());
+ REQUIRE(line.bias() == ::gpiod::line::BIAS_AS_IS);
+ }
+
+ SECTION("exported bias disable line")
+ {
+ ::gpiod::line_request config;
+
+ config.consumer = consumer.c_str();
+ config.request_type = ::gpiod::line_request::DIRECTION_OUTPUT;
+ config.flags = ::gpiod::line_request::FLAG_BIAS_DISABLE;
+ line.request(config);
+
+ REQUIRE(line.offset() == 4);
+ REQUIRE(line.name() == "gpio-mockup-A-4");
+ REQUIRE(line.direction() == ::gpiod::line::DIRECTION_OUTPUT);
+ REQUIRE(line.active_state() == ::gpiod::line::ACTIVE_HIGH);
+ REQUIRE(line.is_requested());
+ REQUIRE(line.is_used());
+ REQUIRE_FALSE(line.is_open_drain());
+ REQUIRE_FALSE(line.is_open_source());
+ REQUIRE(line.bias() == ::gpiod::line::BIAS_DISABLE);
+ }
+
+ SECTION("exported pull-down line")
+ {
+ ::gpiod::line_request config;
+
+ config.consumer = consumer.c_str();
+ config.request_type = ::gpiod::line_request::DIRECTION_OUTPUT;
+ config.flags = ::gpiod::line_request::FLAG_BIAS_PULL_DOWN;
+ line.request(config);
+
+ REQUIRE(line.offset() == 4);
+ REQUIRE(line.name() == "gpio-mockup-A-4");
+ REQUIRE(line.direction() == ::gpiod::line::DIRECTION_OUTPUT);
+ REQUIRE(line.active_state() == ::gpiod::line::ACTIVE_HIGH);
+ REQUIRE(line.is_requested());
+ REQUIRE(line.is_used());
+ REQUIRE_FALSE(line.is_open_drain());
+ REQUIRE_FALSE(line.is_open_source());
+ REQUIRE(line.bias() == ::gpiod::line::BIAS_PULL_DOWN);
+ }
+
+ SECTION("exported pull-up line")
+ {
+ ::gpiod::line_request config;
+
+ config.consumer = consumer.c_str();
+ config.request_type = ::gpiod::line_request::DIRECTION_OUTPUT;
+ config.flags = ::gpiod::line_request::FLAG_BIAS_PULL_UP;
+ line.request(config);
+
+ REQUIRE(line.offset() == 4);
+ REQUIRE(line.name() == "gpio-mockup-A-4");
+ REQUIRE(line.direction() == ::gpiod::line::DIRECTION_OUTPUT);
+ REQUIRE(line.active_state() == ::gpiod::line::ACTIVE_HIGH);
+ REQUIRE(line.is_requested());
+ REQUIRE(line.is_used());
+ REQUIRE_FALSE(line.is_open_drain());
+ REQUIRE_FALSE(line.is_open_source());
+ REQUIRE(line.bias() == ::gpiod::line::BIAS_PULL_UP);
}
SECTION("update line info")