From f0fb2deef1b4593778e4559aeb5ce43714b0a755 Mon Sep 17 00:00:00 2001 From: Pawel Jalocha Date: Wed, 18 Nov 2020 16:46:13 +0000 Subject: [PATCH] Can be compiled for both v4.0 and v4.1 --- main/hal.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main/hal.cpp b/main/hal.cpp index 18cb28f..aaee1e8 100644 --- a/main/hal.cpp +++ b/main/hal.cpp @@ -1779,8 +1779,13 @@ void IO_Configuration(void) i2c_config_t I2C_Config = // I2C for OLED and pressue sensor { mode : I2C_MODE_MASTER, sda_io_num : PIN_I2C_SDA, +#if ESP_IDF_VERSION_MINOR<1 sda_pullup_en : GPIO_PULLUP_ENABLE, scl_io_num : PIN_I2C_SCL, +#else // order of the elements has changed in 4.1 + scl_io_num : PIN_I2C_SCL, + sda_pullup_en : GPIO_PULLUP_ENABLE, +#endif scl_pullup_en : GPIO_PULLUP_ENABLE } ; I2C_Config.master.clk_speed = I2C_SPEED;