Skip to content
Closed
Show file tree
Hide file tree
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
99 changes: 99 additions & 0 deletions extras/multiple_versions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Using Multiple ESP32 Board Versions in Arduino IDE (Windows)

Tested with: **Arduino IDE 2.3.5**\
Target: Use multiple versions of **Espressif's ESP32 Arduino core** side-by-side in the Arduino IDE.

---

## ⚒️ Step-by-step Instructions

### 1. 📂 Prepare Your Folder Structure

Create a `hardware` folder inside your Arduino sketchbook:

```text
C:\Users\%USERNAME%\Documents\Arduino\hardware
```

Inside that, create a subfolder for your desired version:

```text
C:\Users\%USERNAME%\Documents\Arduino\hardware\espressif_2.0.17
```

Clone the ESP32 Arduino core into the `esp32` subfolder:

```bash
cd %USERPROFILE%\Documents\Arduino\hardware\espressif_2.0.17

git clone https://github.com/espressif/arduino-esp32.git esp32

cd esp32

git checkout tags/2.0.17
```

This will download version 2.0.17 into the path:

```text
...\Arduino\hardware\espressif_2.0.17\esp32
```

### 2. 🔄 Restart Arduino IDE

After restarting the Arduino IDE, you will now see both board versions:

- The default one from Boards Manager
- Your custom version from the Sketchbook

Look for entries like:

- `ESP32 Dev Module`
- `ESP32 Dev Module (in Sketchbook) (espressif_2.0.17)`

![grafik](https://github.com/user-attachments/assets/5fa68133-cdfc-461a-acec-9a76942a4a9d)


---

### 3. ⚠️ Compatibility with Arduino IDE < 2.x

Older IDE versions may **not display version labels** in the board selection menu.

To make your custom version distinguishable:

1. Edit this file:

```text
...\Arduino\hardware\espressif_2.0.17\esp32\platform.txt
```

2. Add or modify the `name` field at the top:

```ini
name=ESP32 Arduino (in Sketchbook) (espressif_2.0.17)
```

This ensures proper identification in older IDEs.

---

## ✅ Benefits

- Use different versions of ESP32 platform for different projects
- Test compatibility with older/newer SDKs
- Avoid breaking changes from updates

---

## 💻 Optional: One-liner Script for Setup

```bash
cd %USERPROFILE%\Documents\Arduino\hardware

mkdir espressif_2.0.17 && cd espressif_2.0.17

git clone https://github.com/espressif/arduino-esp32.git esp32

cd esp32 && git checkout tags/2.0.17
```
6 changes: 6 additions & 0 deletions src/audio_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ void Audio_Setup(void)
#endif
#endif

#if defined(DUAL_CODEC_ENABLED) && defined(ES8388_ENABLED)
ES8388_SelectCodec(1);
ES8388_Setup();
ES8388_SetIn2OoutVOL(0, 0);
ES8388_SelectCodec(0);
#endif

#ifdef WM8978_ENABLED
WM8978_Setup();
Expand Down
31 changes: 27 additions & 4 deletions src/es8388.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ void ES8388_SetOUT1VOL(float vol);
void ES8388_SetOUT1VOL(uint8_t unused, float vol);
void ES8388_SetOUT2VOL(float vol);
void ES8388_SetOUT2VOL(uint8_t unused, float vol);

#ifdef DUAL_CODEC_ENABLED
void ES8388_SelectCodec(bool select);
#endif

#endif // ES8388_ENABLED
#endif // #ifdef ML_SYNTH_INLINE_DECLARATION
Expand All @@ -75,6 +77,7 @@ void ES8388_SetOUT2VOL(uint8_t unused, float vol);
/* ES8388 address */
//#define ES8388_ADDR 0x20 /*!< 0x22:CE=1;0x20:CE=0*/
#define ES8388_ADDR 0x10 /*!< 0x22:CE=1;0x20:CE=0*/
#define ES8388_ADDR_SECONDARY 0x11 /*!< 0x22:CE=1;0x20:CE=0*/


/* ES8388 register */
Expand Down Expand Up @@ -139,15 +142,35 @@ void ES8388_SetOUT2VOL(uint8_t unused, float vol);
#define ES8388_DACCONTROL29 0x33
#define ES8388_DACCONTROL30 0x34

bool selected_codec_id = 0;
uint16_t codecAddress = ES8388_ADDR;

void ES8388_SelectCodec(bool select)
{
if (selected_codec_id != select)
{
if (select)
{
codecAddress = ES8388_ADDR_SECONDARY;
selected_codec_id = 1;
}
else
{
codecAddress = ES8388_ADDR;
selected_codec_id = 0;
}
}
return;
}

uint8_t ES8388_ReadReg(uint8_t reg)
{
Wire.beginTransmission(ES8388_ADDR);
Wire.beginTransmission(codecAddress);
Wire.write(reg);
Wire.endTransmission(false);

uint8_t val = 0u;
if (1 == Wire.requestFrom(uint16_t(ES8388_ADDR), uint8_t(1), true))
if (1 == Wire.requestFrom(uint16_t(codecAddress), uint8_t(1), true))
{
val = Wire.read();
}
Expand All @@ -157,7 +180,7 @@ uint8_t ES8388_ReadReg(uint8_t reg)

bool ES8388_WriteReg(uint8_t reg, uint8_t val)
{
Wire.beginTransmission(ES8388_ADDR);
Wire.beginTransmission(codecAddress);
Wire.write(reg);
Wire.write(val);
return 0 == Wire.endTransmission(true);
Expand Down
Loading