-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathboard_audio_kit_es8388.h
154 lines (134 loc) · 4.66 KB
/
board_audio_kit_es8388.h
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
* Copyright (c) 2025 Marcel Licence
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Dieses Programm ist Freie Software: Sie können es unter den Bedingungen
* der GNU General Public License, wie von der Free Software Foundation,
* Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren
* veröffentlichten Version, weiter verteilen und/oder modifizieren.
*
* Dieses Programm wird in der Hoffnung bereitgestellt, dass es nützlich sein wird, jedoch
* OHNE JEDE GEWÄHR,; sogar ohne die implizite
* Gewähr der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
* Siehe die GNU General Public License für weitere Einzelheiten.
*
* Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
* Programm erhalten haben. Wenn nicht, siehe <https://www.gnu.org/licenses/>.
*/
/**
* @file board_audio_kit_es8388.h
* @author Marcel Licence
* @date 22.09.2021
*
* @brief Board description for the ESP32 Audio Kit with the ES8388
*
* ES8388_CFG_I2C can be set to 1..3 to match different datasheets
* ES8388_CFG_I2S can be set to 1..3 to match different datasheets
*
* 2 - coveres pinout shown in https://www.makerfabs.com/desfile/files/ESP32-A1S%20Product%20Specification.pdf
* 3 - coveres pinout shown in https://docs.ai-thinker.com/_media/esp32-a1s_v2.3_specification.pdf
* 4 - unknown origin
*
* Tested configuration: I2C: 1, I2S: 4
*
* DOUT is used to send data from the ESP32 to the audio codec (connected to in of the codec)
* DIN is used to receive data from the audio codec (data input of the ESP32 conneced to the codecs data output)
*/
#ifndef BOARDS_BOARD_AUDIO_KIT_ES8388_H_
#define BOARDS_BOARD_AUDIO_KIT_ES8388_H_
#define ES8388_CFG_I2C 1
#define ES8388_CFG_I2S 4
/* on board led */
#define BLINK_LED_PIN 19 // IO19 -> D5
#define MIDI_PORT2_ACTIVE
#define MIDI_RX2_PIN 21 /* D5 LED will blink then */
#define LED_STRIP_PIN 12
#if ES8388_CFG_I2C==1
#define ES8388_PIN_SDA 18
#define ES8388_PIN_SCL 23
#define I2C_SDA 18 /* I2C shared with pin header */
#define I2C_SCL 23 /* I2C shared with pin header */
#elif ES8388_CFG_I2C==2
#define ES8388_PIN_SDA 33
#define ES8388_PIN_SCL 32
#elif ES8388_CFG_I2C==3
#define ES8388_PIN_SDA 27
#define ES8388_PIN_SCL 28
#endif
#if ES8388_CFG_I2S==1
#define ES8388_PIN_DOUT 35
#define ES8388_PIN_DIN 25
#define ES8388_PIN_LRCK 26
#define ES8388_PIN_SCLK 27
#define ES8388_PIN_MCLK 0
#elif ES8388_CFG_I2S==2
#define ES8388_PIN_DOUT 35
#define ES8388_PIN_DIN 25
#define ES8388_PIN_LRCK 26
#define ES8388_PIN_SCLK 5
#define ES8388_PIN_MCLK 0
#elif ES8388_CFG_I2S==3
#define ES8388_PIN_DOUT 8
#define ES8388_PIN_DIN 6
#define ES8388_PIN_LRCK 7
#define ES8388_PIN_SCLK 5
#define ES8388_PIN_MCLK 1
#elif ES8388_CFG_I2S==4
#define ES8388_PIN_DOUT 35
#define ES8388_PIN_DIN 26
#define ES8388_PIN_LRCK 25
#define ES8388_PIN_SCLK 5
#define ES8388_PIN_MCLK 0
#elif ES8388_CFG_I2S==5
/* please refer to lyrat_v4_3 pins configuration which can be found on the ESP32 Audio Kit as-well */
#define ES8388_PIN_DOUT 35
#define ES8388_PIN_DIN 26
#define ES8388_PIN_LRCK 25
#define ES8388_PIN_SCLK 27
#define ES8388_PIN_MCLK 0
#elif ES8388_CFG_I2S==6
/* same as above but using IO1 for MCLK instead of IO0 */
#define ES8388_PIN_DOUT 35
#define ES8388_PIN_DIN 26
#define ES8388_PIN_LRCK 25
#define ES8388_PIN_SCLK 27
#define ES8388_PIN_MCLK 1
#elif ES8388_CFG_I2S==7
/* DOUT and DIN are swapped used for A247 */
#define ES8388_PIN_DOUT 26
#define ES8388_PIN_DIN 35
#define ES8388_PIN_LRCK 25
#define ES8388_PIN_SCLK 27
#define ES8388_PIN_MCLK 0
#endif
#define ESP32_AUDIO_KIT
#define ES8388_ENABLED
#define I2S_USE_APLL
#define SD_MMC_ENABLED
#ifdef ADC_TO_MIDI_ENABLED
#define ADC_INPUTS 8
#define ADC_MUL_S0_PIN 23
#define ADC_MUL_S1_PIN 18
#define ADC_MUL_S2_PIN 14
#define ADC_MUL_S3_PIN 5 /* <- not used, this has not been tested */
#define ADC_MUL_SIG_PIN 12
#endif
/* map selected pins to global */
#define I2S_MCLK_PIN ES8388_PIN_MCLK
#define I2S_BCLK_PIN ES8388_PIN_SCLK
#define I2S_WCLK_PIN ES8388_PIN_LRCK
#define I2S_DOUT_PIN ES8388_PIN_DIN
#define I2S_DIN_PIN ES8388_PIN_DOUT
#endif /* BOARDS_BOARD_AUDIO_KIT_ES8388_H_ */