mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
i2c: support esp32h2
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*
|
||||
@@ -318,6 +318,7 @@ struct I2CMasterFix {
|
||||
i2c_port_t port;
|
||||
};
|
||||
|
||||
#if CONFIG_SOC_I2C_SUPPORT_SLAVE
|
||||
struct I2CSlaveFix {
|
||||
I2CSlaveFix(CreateAnd flags, i2c_port_t port_arg = 0, size_t buffer_size = 64) : i2c_conf(), port(port_arg)
|
||||
{
|
||||
@@ -344,6 +345,7 @@ struct I2CSlaveFix {
|
||||
i2c_config_t i2c_conf;
|
||||
i2c_port_t port;
|
||||
};
|
||||
#endif // CONFIG_SOC_I2C_SUPPORT_SLAVE
|
||||
|
||||
struct I2CCmdLinkFix
|
||||
{
|
||||
|
@@ -376,6 +376,7 @@ TEST_CASE("I2CMaster syncronous transfer (read and write)")
|
||||
}
|
||||
}
|
||||
|
||||
#if SOC_I2C_SUPPORT_SLAVE
|
||||
TEST_CASE("I2CSlave parameter configuration fails")
|
||||
{
|
||||
CMockFixture fix;
|
||||
@@ -458,3 +459,4 @@ TEST_CASE("I2CSlave read calls driver functions correctly")
|
||||
CHECK(read_buffer[i] == WRITE_BUFFER[i]);
|
||||
}
|
||||
}
|
||||
#endif // SOC_I2C_SUPPORT_SLAVE
|
||||
|
@@ -155,6 +155,7 @@ vector<uint8_t> I2CMaster::sync_transfer(I2CAddress i2c_addr,
|
||||
return composed_transfer.do_transfer(i2c_num, i2c_addr)[0];
|
||||
}
|
||||
|
||||
#if CONFIG_SOC_I2C_SUPPORT_SLAVE
|
||||
I2CSlave::I2CSlave(I2CNumber i2c_number,
|
||||
SCL_GPIO scl_gpio,
|
||||
SDA_GPIO sda_gpio,
|
||||
@@ -191,6 +192,7 @@ int I2CSlave::read_raw(uint8_t *buffer, size_t buffer_len, chrono::milliseconds
|
||||
{
|
||||
return i2c_slave_read_buffer(i2c_num.get_value(), buffer, buffer_len, (TickType_t) timeout.count() / portTICK_PERIOD_MS);
|
||||
}
|
||||
#endif // CONFIG_SOC_I2C_SUPPORT_SLAVE
|
||||
|
||||
I2CWrite::I2CWrite(const vector<uint8_t> &bytes, chrono::milliseconds driver_timeout)
|
||||
: I2CTransfer<void>(driver_timeout), bytes(bytes)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -400,6 +400,7 @@ public:
|
||||
size_t read_n_bytes);
|
||||
};
|
||||
|
||||
#if CONFIG_SOC_I2C_SUPPORT_SLAVE
|
||||
/**
|
||||
* @brief Responsible for initialization and de-initialization of an I2C slave peripheral.
|
||||
*/
|
||||
@@ -451,6 +452,7 @@ public:
|
||||
*/
|
||||
virtual int read_raw(uint8_t* buffer, size_t buffer_len, std::chrono::milliseconds timeout);
|
||||
};
|
||||
#endif // CONFIG_SOC_I2C_SUPPORT_SLAVE
|
||||
|
||||
/**
|
||||
* Implementation for simple I2C writes, which can be executed by \c I2CMaster::transfer().
|
||||
|
@@ -54,8 +54,9 @@ struct MasterFixture {
|
||||
vector<uint8_t> data;
|
||||
};
|
||||
|
||||
#if SOC_I2C_SUPPORT_SALVE
|
||||
// TODO The I2C driver tests are disabled, so disable them here, too. Probably due to no runners.
|
||||
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2, ESP32S3)
|
||||
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2, ESP32S3, ESP8684)
|
||||
|
||||
static void i2c_slave_read_raw_byte(void)
|
||||
{
|
||||
@@ -258,4 +259,5 @@ TEST_CASE_MULTIPLE_DEVICES("I2CMaster Composed transfer", "[cxx i2c][test_env=UT
|
||||
i2c_master_composed_trans, i2c_slave_composed_trans);
|
||||
|
||||
#endif //TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2, ESP32S3)
|
||||
#endif // SOC_I2C_SUPPORT_SALVE
|
||||
#endif // __cpp_exceptions
|
||||
|
Reference in New Issue
Block a user