Fork of Tangara with customizations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tangara-fw/src/drivers/test/test_gpio_expander.cpp

27 lines
573 B

#include "gpio_expander.hpp"
#include "catch2/catch.hpp"
#include "i2c.hpp"
#include "i2c_fixture.hpp"
namespace drivers {
TEST_CASE("gpio expander", "[integration]") {
I2CFixture i2c;
GpioExpander expander;
SECTION("with() writes when ") {
// Initial value.
expander.Read();
REQUIRE(expander.get_input(GpioExpander::KEY_DOWN) == true);
expander.with(
[&](auto& gpio) { gpio.set_pin(GpioExpander::KEY_DOWN, false); });
expander.Read();
REQUIRE(expander.get_input(GpioExpander::KEY_DOWN) == false);
}
}
} // namespace drivers