Skip to content

Commit 39aab1b

Browse files
committed
esp32 h2 support
1 parent f3e5838 commit 39aab1b

File tree

1 file changed

+43
-8
lines changed

1 file changed

+43
-8
lines changed

src/AudioConfig.h

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,6 @@ typedef WiFiClient WiFiClientSecure;
236236
# define USE_PDM
237237
# define USE_PDM_RX
238238
#endif
239-
#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32H2)
240-
# define ESP32H2
241-
# define ESP32X
242-
# define USE_TDM
243-
# define USE_PDM
244-
#endif
245239
#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32C6)
246240
# define ESP32C6
247241
# define ESP32X
@@ -273,7 +267,7 @@ typedef WiFiClient WiFiClientSecure;
273267
#endif
274268

275269
// ----- Regular ESP32 -----
276-
#if defined(ESP32) && !defined(ESP32X)
270+
#if defined(ESP32) && !defined(ESP32X) && !defined(CONFIG_IDF_TARGET_ESP32H2)
277271
#if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 0 , 0)
278272
# define USE_INT24_FROM_INT
279273
#endif
@@ -347,7 +341,7 @@ typedef uint32_t eps32_i2s_sample_rate_type;
347341

348342
//-------ESP32C3, ESP32S3, ESP32S2---------
349343

350-
#if defined(ESP32) && defined(ESP32X)
344+
#if defined(ESP32) && defined(ESP32X)
351345
#include "esp32-hal-log.h"
352346
#if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 0 , 0)
353347
# define USE_INT24_FROM_INT
@@ -404,6 +398,47 @@ typedef uint32_t eps32_i2s_sample_rate_type;
404398

405399
#endif
406400

401+
//-------ESP32H2---------
402+
403+
#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32H2)
404+
#include "esp32-hal-log.h"
405+
# define ESP32H2
406+
# define USE_TDM
407+
#if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 0 , 0)
408+
# define USE_INT24_FROM_INT
409+
# define USE_ANALOG
410+
#endif
411+
412+
#define USE_PWM
413+
#define USE_I2S
414+
#define USE_TYPETRAITS
415+
#define USE_EFFECTS_SUITE
416+
#define USE_TIMER
417+
#define USE_STREAM_WRITE_OVERRIDE
418+
#define USE_STREAM_READ_OVERRIDE
419+
// support for psram -> set to true
420+
#define USE_ALLOCATOR true
421+
//#define USE_INITIALIZER_LIST
422+
423+
#define PWM_FREQENCY 30000
424+
#define PIN_PWM_START 1
425+
#define PIN_I2S_MCK -1
426+
#define PIN_I2S_BCK 6
427+
#define PIN_I2S_WS 7
428+
#define PIN_I2S_DATA_OUT 8
429+
#define PIN_I2S_DATA_IN 9
430+
#define I2S_USE_APLL true
431+
// Default Setting: The mute pin can be switched actovated by setting it to a gpio (e.g 5). Or you could drive the LED by assigning LED_BUILTIN
432+
#define PIN_I2S_MUTE -1
433+
#define SOFT_MUTE_VALUE 0
434+
#define PIN_CS SS
435+
#define PIN_ADC1 21
436+
#define I2S_AUTO_CLEAR true
437+
438+
typedef uint32_t eps32_i2s_sample_rate_type;
439+
440+
#endif
441+
407442

408443
//----- ESP8266 -----------
409444
#ifdef ESP8266

0 commit comments

Comments
 (0)