Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arduino 3.2.0 based on ESP-IDF v5.4 #10832

Merged
merged 4 commits into from
Feb 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -245,7 +245,7 @@ jobs:
# See https://hub.docker.com/r/espressif/idf/tags and
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html
# for details.
idf_ver: ["release-v5.3"]
idf_ver: ["release-v5.4"]
idf_target:
[
"esp32",
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
# idf.py build

set(min_supported_idf_version "5.3.0")
set(max_supported_idf_version "5.3.99")
set(max_supported_idf_version "5.4.99")
set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}")

if ("${idf_version}" AND NOT "$ENV{ARDUINO_SKIP_IDF_VERSION_CHECK}")
@@ -33,6 +33,7 @@ set(CORE_SRCS
cores/esp32/esp32-hal-dac.c
cores/esp32/esp32-hal-gpio.c
cores/esp32/esp32-hal-i2c.c
cores/esp32/esp32-hal-i2c-ng.c
cores/esp32/esp32-hal-i2c-slave.c
cores/esp32/esp32-hal-ledc.c
cores/esp32/esp32-hal-matrix.c
445 changes: 445 additions & 0 deletions cores/esp32/esp32-hal-i2c-ng.c

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions cores/esp32/esp32-hal-i2c-slave.c
Original file line number Diff line number Diff line change
@@ -336,7 +336,11 @@ esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t
#endif // !defined(CONFIG_IDF_TARGET_ESP32P4)

i2c_ll_slave_init(i2c->dev);
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
i2c_ll_enable_fifo_mode(i2c->dev, true);
#else
i2c_ll_slave_set_fifo_mode(i2c->dev, true);
#endif
i2c_ll_set_slave_addr(i2c->dev, slaveID, false);
i2c_ll_set_tout(i2c->dev, I2C_LL_MAX_TIMEOUT);
i2c_slave_set_frequency(i2c, frequency);
@@ -357,7 +361,11 @@ esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t

i2c_ll_disable_intr_mask(i2c->dev, I2C_LL_INTR_MASK);
i2c_ll_clear_intr_mask(i2c->dev, I2C_LL_INTR_MASK);
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
i2c_ll_enable_fifo_mode(i2c->dev, true);
#else
i2c_ll_slave_set_fifo_mode(i2c->dev, true);
#endif

if (!i2c->intr_handle) {
uint32_t flags = ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_SHARED;
3 changes: 3 additions & 0 deletions cores/esp32/esp32-hal-i2c.c
Original file line number Diff line number Diff line change
@@ -15,6 +15,8 @@
#include "esp32-hal-i2c.h"

#if SOC_I2C_SUPPORTED
#include "esp_idf_version.h"
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 4, 0)
#include "esp32-hal.h"
#if !CONFIG_DISABLE_HAL_LOCKS
#include "freertos/FreeRTOS.h"
@@ -429,4 +431,5 @@ esp_err_t i2cGetClock(uint8_t i2c_num, uint32_t *frequency) {
return ESP_OK;
}

#endif /* ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 4, 0) */
#endif /* SOC_I2C_SUPPORTED */
2 changes: 1 addition & 1 deletion idf_component.yml
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ files:
- "platform.txt"
- "programmers.txt"
dependencies:
idf: ">=5.3,<5.4"
idf: ">=5.3,<5.5"
# mdns 1.2.1 is necessary to build H2 with no WiFi
espressif/mdns:
version: "^1.2.3"
3 changes: 3 additions & 0 deletions libraries/Ethernet/src/ETH.cpp
Original file line number Diff line number Diff line change
@@ -283,6 +283,9 @@ bool ETHClass::begin(eth_phy_type_t type, int32_t phy_addr, int mdc, int mdio, i

esp_eth_phy_t *phy = NULL;
switch (type) {
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
case ETH_PHY_GENERIC: phy = esp_eth_phy_new_generic(&phy_config); break;
#endif
case ETH_PHY_LAN8720: phy = esp_eth_phy_new_lan87xx(&phy_config); break;
case ETH_PHY_TLK110: phy = esp_eth_phy_new_ip101(&phy_config); break;
case ETH_PHY_RTL8201: phy = esp_eth_phy_new_rtl8201(&phy_config); break;
5 changes: 5 additions & 0 deletions libraries/Ethernet/src/ETH.h
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@

#ifndef _ETH_H_
#define _ETH_H_
#include "esp_idf_version.h"

//
// Example configurations for pins_arduino.h to allow starting with ETH.begin();
@@ -127,6 +128,10 @@ typedef emac_rmii_clock_mode_t eth_clock_mode_t;

typedef enum {
#if CONFIG_ETH_USE_ESP32_EMAC
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
ETH_PHY_GENERIC,
#define ETH_PHY_JL1101 ETH_PHY_GENERIC
#endif
ETH_PHY_LAN8720,
ETH_PHY_TLK110,
ETH_PHY_RTL8201,
17 changes: 13 additions & 4 deletions libraries/Wire/src/Wire.cpp
Original file line number Diff line number Diff line change
@@ -462,10 +462,11 @@ uint8_t TwoWire::endTransmission(bool sendStop) {
nonStop = true;
}
switch (err) {
case ESP_OK: return 0;
case ESP_FAIL: return 2;
case ESP_ERR_TIMEOUT: return 5;
default: break;
case ESP_OK: return 0;
case ESP_FAIL: return 2;
case ESP_ERR_NOT_FOUND: return 2;
case ESP_ERR_TIMEOUT: return 5;
default: break;
}
return 4;
}
@@ -646,8 +647,16 @@ void TwoWire::onRequestService(uint8_t num, void *arg) {
#endif /* SOC_I2C_SUPPORT_SLAVE */

TwoWire Wire = TwoWire(0);
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
#if SOC_I2C_NUM > 1
TwoWire Wire1 = TwoWire(1);
#elif SOC_I2C_NUM > 2
TwoWire Wire2 = TwoWire(2);
#endif /* SOC_I2C_NUM */
#else
#if SOC_HP_I2C_NUM > 1
TwoWire Wire1 = TwoWire(1);
#endif /* SOC_HP_I2C_NUM */
#endif

#endif /* SOC_I2C_SUPPORTED */
9 changes: 9 additions & 0 deletions libraries/Wire/src/Wire.h
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@

#include "soc/soc_caps.h"
#if SOC_I2C_SUPPORTED
#include "esp_idf_version.h"

#include <esp32-hal.h>
#include <esp32-hal-log.h>
@@ -144,9 +145,17 @@ class TwoWire : public HardwareI2C {
};

extern TwoWire Wire;
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 4, 0)
#if SOC_I2C_NUM > 1
extern TwoWire Wire1;
#elif SOC_I2C_NUM > 2
extern TwoWire Wire2;
#endif /* SOC_I2C_NUM */
#else
#if SOC_HP_I2C_NUM > 1
extern TwoWire Wire1;
#endif /* SOC_HP_I2C_NUM */
#endif

#endif /* SOC_I2C_SUPPORTED */
#endif /* TwoWire_h */
5 changes: 5 additions & 0 deletions variants/esp32c6/pins_arduino.h
Original file line number Diff line number Diff line change
@@ -32,4 +32,9 @@ static const uint8_t A4 = 4;
static const uint8_t A5 = 5;
static const uint8_t A6 = 6;

// LP I2C Pins are fixed on ESP32-C6
#define WIRE1_PIN_DEFINED
static const uint8_t SDA1 = 6;
static const uint8_t SCL1 = 7;

#endif /* Pins_Arduino_h */