Skip to content

Commit

Permalink
[i2c] Use correct macro to determine number of i2c peripherals for idf (
Browse files Browse the repository at this point in the history
  • Loading branch information
jesserockz authored Dec 10, 2024
1 parent 444e162 commit 7aa54b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions esphome/components/i2c/i2c_bus_esp_idf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ void IDFI2CBus::setup() {
ESP_LOGCONFIG(TAG, "Setting up I2C bus...");
static i2c_port_t next_port = I2C_NUM_0;
port_ = next_port;
#if I2C_NUM_MAX > 1
#if SOC_I2C_NUM > 1
next_port = (next_port == I2C_NUM_0) ? I2C_NUM_1 : I2C_NUM_MAX;
#else
next_port = I2C_NUM_MAX;
#endif

if (port_ == I2C_NUM_MAX) {
ESP_LOGE(TAG, "Too many I2C buses configured");
ESP_LOGE(TAG, "Too many I2C buses configured. Max %u supported.", SOC_I2C_NUM);
this->mark_failed();
return;
}
Expand Down

0 comments on commit 7aa54b6

Please sign in to comment.