[cxx]: fixed I2C master timeout

This commit is contained in:
Jakob Hasse
2021-07-05 19:10:59 +08:00
parent afe14a5ed2
commit 77909446f5
2 changed files with 11 additions and 1 deletions

View File

@@ -69,6 +69,16 @@ TEST_CASE("I2CMaster SDA and SCL equal", "[cxx i2c][leaks=300]")
TEST_THROW(I2CMaster(0, 0, 0, 400000), I2CException);
}
TEST_CASE("I2Transfer timeout", "[cxx i2c][leaks=300]")
{
std::vector<uint8_t> data = {MAGIC_TEST_NUMBER};
// I2CWrite directly inherits from I2CTransfer; it's representative for I2CRead and I2CComposed, too.
I2CWrite writer(data, chrono::milliseconds(50));
TEST_THROW(writer.do_transfer(I2C_MASTER_NUM, ADDR), I2CTransferException);
}
// TODO The I2C driver tests are disabled, so disable them here, too. Probably due to no runners.
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2, ESP32S3)