wangzhibo
2026-10-08 220e4fab27b7f419b3e89e2f2d28ae789aac09d7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#pragma once
 
#include <driver/gpio.h>
#include "sdkconfig.h"
 
/* Audio configuration */
#define AUDIO_INPUT_SAMPLE_RATE  16000
#define AUDIO_OUTPUT_SAMPLE_RATE 16000
#define AUDIO_INPUT_REFERENCE    false
#define AUDIO_CODEC_ES8311_ADDR  ES8311_CODEC_DEFAULT_ADDR
 
/* ADC configuration */
#define ADC_ATTEN                ADC_ATTEN_DB_12
#define ADC_WIDTH                ADC_BITWIDTH_DEFAULT
#define FULL_BATTERY_VOLTAGE     4100
#define EMPTY_BATTERY_VOLTAGE    3200
 
/* I2C configuration */
#define I2C_MASTER_FREQ_HZ      (400 * 1000)
 
/* Button configuration */
#define LONG_PRESS_TIMEOUT_US   (5 * 1000000ULL)
 
#ifdef CONFIG_IDF_TARGET_ESP32S3
 
/* Audio I2S GPIOs */
#define AUDIO_I2S_GPIO_MCLK      GPIO_NUM_NC
#define AUDIO_I2S_GPIO_WS        GPIO_NUM_17
#define AUDIO_I2S_GPIO_BCLK      GPIO_NUM_16
#define AUDIO_I2S_GPIO_DIN       GPIO_NUM_15
#define AUDIO_I2S_GPIO_DOUT      GPIO_NUM_18
 
/* Audio CODEC GPIOs */
#define AUDIO_CODEC_PA_PIN       GPIO_NUM_40
#define AUDIO_CODEC_I2C_SDA_PIN  GPIO_NUM_2
#define AUDIO_CODEC_I2C_SCL_PIN  GPIO_NUM_1
 
/* Button GPIOs */
#define BOOT_BUTTON_GPIO         GPIO_NUM_0
#define KEY_BUTTON_GPIO          GPIO_NUM_12
#define LED_GPIO                 GPIO_NUM_11
 
/* ADC GPIOs */
#define VBAT_ADC_CHANNEL         ADC_CHANNEL_9  // S3: IO10
#define MCU_VCC_CTL              GPIO_NUM_4     // set 1 to power on MCU
#define PERP_VCC_CTL             GPIO_NUM_6     // set 1 to power on peripherals
 
/* IMU GPIOs */
#define IMU_INT_GPIO             GPIO_NUM_5
 
#elif defined(CONFIG_IDF_TARGET_ESP32C5)
 
/* Audio I2S GPIOs */
#define AUDIO_I2S_GPIO_MCLK      GPIO_NUM_NC
#define AUDIO_I2S_GPIO_WS        GPIO_NUM_8
#define AUDIO_I2S_GPIO_BCLK      GPIO_NUM_7
#define AUDIO_I2S_GPIO_DIN       GPIO_NUM_6
#define AUDIO_I2S_GPIO_DOUT      GPIO_NUM_9
 
/* Audio CODEC GPIOs */
#define AUDIO_CODEC_PA_PIN       GPIO_NUM_23
#define AUDIO_CODEC_I2C_SDA_PIN  GPIO_NUM_25
#define AUDIO_CODEC_I2C_SCL_PIN  GPIO_NUM_26
 
/* Button GPIOs */
#define BOOT_BUTTON_GPIO         GPIO_NUM_28
#define KEY_BUTTON_GPIO          GPIO_NUM_5
#define LED_GPIO                 GPIO_NUM_27
 
/* ADC GPIOs */
#define VBAT_ADC_CHANNEL         ADC_CHANNEL_3  // C5: IO4
#define MCU_VCC_CTL              GPIO_NUM_2     // set 1 to power on MCU
#define PERP_VCC_CTL             GPIO_NUM_0     // set 1 to power on peripherals
 
/* IMU GPIOs */
#define IMU_INT_GPIO             GPIO_NUM_3
 
#endif // CONFIG_IDF_TARGET