Skip to content

Commit ec0737e

Browse files
committed
Platform specific config files
1 parent 45f5324 commit ec0737e

File tree

15 files changed

+623
-586
lines changed

15 files changed

+623
-586
lines changed

src/AudioTools/CoreAudio/AudioRuntime.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#pragma once
22

3+
#include <string.h>
4+
#include <stdint.h>
5+
#include <assert.h>
6+
37
#include "AudioToolsConfig.h"
48

59
namespace audio_tools {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#pragma once
2+
3+
# define IS_ZEPHYR
4+
# define NO_INPLACE_INIT_SUPPORT
5+
# define USE_TYPETRAITS
6+
# define USE_I2S
7+
# define PIN_I2S_BCK 2
8+
# define PIN_I2S_WS 3
9+
# define PIN_I2S_DATA_IN 4
10+
# define PIN_I2S_DATA_OUT 4
11+
// Default Setting: The mute pin can be switched actovated by setting it to a gpio (e.g 4). Or you could drive the LED by assigning LED_BUILTIN
12+
# define PIN_I2S_MUTE -1
13+
# define SOFT_MUTE_VALUE 0
14+
# define USE_NANO33BLE
15+
# define USE_ALT_PIN_SUPPORT

src/AudioTools/PlatformConfig/avr.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#pragme once
2+
3+
#define USE_SD_NO_NS
4+
#define USE_PWM
5+
#define USE_TIMER
6+
#define NO_INPLACE_INIT_SUPPORT
7+
// Uncomment to activate network
8+
//#include <Ethernet.h>
9+
//#define USE_URL_ARDUINO
10+
#ifndef assert
11+
# define assert(T)
12+
#endif
13+
14+
#define PIN_PWM_START 6
15+
#define PIN_CS SS
16+
17+
#undef PWM_BUFFER_SIZE
18+
#define PWM_BUFFER_SIZE 125
19+
20+
#undef DEFAULT_BUFFER_SIZE
21+
#define DEFAULT_BUFFER_SIZE 125
22+
23+
// logging is using too much memory
24+
#undef USE_AUDIO_LOGGING
25+
#undef LOG_PRINTF_BUFFER_SIZE
26+
#define LOG_PRINTF_BUFFER_SIZE 60
27+
#define NO_TRACED
28+
#define NO_TRACEI
29+
#define NO_TRACEE
30+
31+
// we use spi to emulate i2s
32+
#define PIN_I2S_BCK 13
33+
#define PIN_I2S_WS 10
34+
#define PIN_I2S_DATA_IN 12
35+
#define PIN_I2S_DATA_OUT 11
36+
#define PIN_I2S_MUTE -1
37+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#pragma once
2+
3+
#if defined(IS_MIN_DESKTOP)
4+
# include "AudioTools/AudioLibs/Desktop/NoArduino.h"
5+
# include "AudioTools/AudioLibs/Desktop/Time.h"
6+
# include "AudioTools/AudioLibs/Desktop/Main.h"
7+
# define USE_STREAM_READ_OVERRIDE
8+
# define USE_SD_NO_NS
9+
# ifndef EXIT_ON_STOP
10+
# define EXIT_ON_STOP
11+
# endif
12+
#elif defined(IS_DESKTOP_WITH_TIME_ONLY)
13+
# include "AudioTools/AudioLibs/Desktop/Time.h"
14+
# include "AudioTools/AudioLibs/Desktop/NoArduino.h"
15+
# define USE_SD_NO_NS
16+
# ifndef EXIT_ON_STOP
17+
# define EXIT_ON_STOP
18+
# endif
19+
#elif defined(IS_DESKTOP)
20+
# include "Arduino.h"
21+
# include <Client.h>
22+
# include <WiFi.h>
23+
# define USE_SD_NO_NS
24+
# define USE_WIFI
25+
# define USE_URL_ARDUINO
26+
# define USE_STREAM_WRITE_OVERRIDE
27+
# define USE_STREAM_READ_OVERRIDE
28+
# define USE_STREAM_READCHAR_OVERRIDE
29+
# ifndef EXIT_ON_STOP
30+
# define EXIT_ON_STOP
31+
# endif
32+
//# define USE_3BYTE_INT24
33+
typedef WiFiClient WiFiClientSecure;
34+
#elif defined(ARDUINO)
35+
# include "Arduino.h"
36+
// --- ESP32 ------------
37+
// E.g when using the Espressif IDF. Use cmake for the necesseary defines
38+
#elif defined(ESP32_CMAKE)
39+
# define ESP32
40+
# include "esp_idf_version.h"
41+
# include "AudioTools/AudioLibs/Desktop/NoArduino.h"
42+
#else
43+
# include "AudioTools/AudioLibs/Desktop/NoArduino.h"
44+
# define IS_JUPYTER
45+
# define USE_STREAM_READ_OVERRIDE
46+
#endif

src/AudioTools/PlatformConfig/esp32.h

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
#pragma once
2+
3+
//-------ESP32---------
4+
#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32S2)
5+
# define ESP32S2
6+
# define ESP32X
7+
#endif
8+
#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32S3)
9+
# define ESP32S3
10+
# define ESP32X
11+
# define USE_TDM
12+
# define USE_PDM
13+
# define USE_PDM_RX
14+
#endif
15+
#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32C3)
16+
# define ESP32C3
17+
# define ESP32X
18+
# define USE_INT24_FROM_INT
19+
# define USE_TDM
20+
# define USE_PDM
21+
#endif
22+
#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32C5)
23+
# define ESP32C5
24+
# define ESP32X
25+
# define USE_TDM
26+
# define USE_PDM
27+
#endif
28+
#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32C6)
29+
# define ESP32C6
30+
# define ESP32X
31+
# define USE_TDM
32+
# define USE_PDM
33+
#endif
34+
#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32P4)
35+
# define ESP32P4
36+
# define ESP32X
37+
# define USE_TDM
38+
# define USE_PDM
39+
# define USE_PDM_RX
40+
#endif
41+
42+
//-------Config for ESP32 families ---------
43+
#if defined(ESP32)
44+
# define USE_STRTOD
45+
// We need to use accept instead of available
46+
# if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
47+
# define USE_SERVER_ACCEPT true
48+
# endif
49+
# if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
50+
# define USE_CONCURRENCY
51+
// Print has been fixed
52+
# define USE_PRINT_FLUSH true
53+
# else
54+
# define USE_PRINT_FLUSH false
55+
# endif
56+
# define USE_SD_SUPPORTS_SPI
57+
//# define USE_ESP32_LOGGER true
58+
# if !defined(ARDUINO)
59+
# define USE_IDF_LOGGER
60+
# endif
61+
# if !defined(I2S_USE_APLL)
62+
# define I2S_USE_APLL false
63+
# endif
64+
#endif
65+
66+
// ----- Regular ESP32 -----
67+
#if defined(ESP32) && !defined(ESP32X) && !defined(CONFIG_IDF_TARGET_ESP32H2)
68+
#if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 0 , 0)
69+
# define USE_INT24_FROM_INT
70+
# define USE_PDM
71+
#endif
72+
73+
#define USE_ANALOG
74+
#define USE_I2S
75+
#define USE_PDM_RX
76+
77+
#ifdef ARDUINO
78+
# define USE_PWM
79+
# define USE_WIFI
80+
# define USE_WIFI_CLIENT_SECURE
81+
# define USE_URL_ARDUINO
82+
# define USE_AUDIO_SERVER
83+
# define USE_TIMER
84+
# define USE_TOUCH_READ
85+
#endif
86+
87+
#define USE_TYPETRAITS
88+
#define USE_STREAM_WRITE_OVERRIDE
89+
#define USE_STREAM_READ_OVERRIDE
90+
#define USE_EXT_BUTTON_LOGIC
91+
// support for psram -> set to true
92+
#define USE_ALLOCATOR true
93+
#define HAS_IOSTRAM
94+
#define USE_TASK false
95+
96+
#define PWM_FREQENCY 30000
97+
#define PIN_PWM_START 12
98+
#define PIN_I2S_BCK 14
99+
#define PIN_I2S_WS 15
100+
#define PIN_I2S_DATA_IN 32
101+
#define PIN_I2S_DATA_OUT 22
102+
#define PIN_I2S_MCK -1
103+
// Default Setting: The mute pin can be switched actovated by setting it to a gpio (e.g 23). Or you could drive the LED by assigning LED_BUILTIN
104+
#define PIN_I2S_MUTE -1
105+
#define SOFT_MUTE_VALUE 0
106+
#define PIN_CS SS
107+
#define PIN_ADC1 34
108+
109+
#define I2S_AUTO_CLEAR true
110+
111+
// URLStream
112+
#define URL_STREAM_CORE 0
113+
#define URL_STREAM_PRIORITY 2
114+
#define URL_STREAM_BUFFER_COUNT 10
115+
#define STACK_SIZE 30000
116+
#define URL_CLIENT_TIMEOUT 60000;
117+
#define URL_HANDSHAKE_TIMEOUT 120000
118+
119+
// // Default LED
120+
// #ifndef LED_BUILTIN
121+
// # define LED_BUILTIN 13 // pin number is specific to your esp32 board
122+
// #endif
123+
124+
// support for old idf releases
125+
#if ESP_IDF_VERSION_MAJOR < 4 && !defined(I2S_COMM_FORMAT_STAND_I2S)
126+
# define I2S_COMM_FORMAT_STAND_I2S (I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB)
127+
# define I2S_COMM_FORMAT_STAND_MSB (I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_LSB)
128+
# define I2S_COMM_FORMAT_STAND_PCM_LONG (I2S_COMM_FORMAT_PCM | I2S_COMM_FORMAT_PCM_LONG)
129+
# define I2S_COMM_FORMAT_STAND_PCM_SHORT (I2S_COMM_FORMAT_PCM | I2S_COMM_FORMAT_PCM_SHORT)
130+
131+
typedef int eps32_i2s_sample_rate_type;
132+
#else
133+
typedef uint32_t eps32_i2s_sample_rate_type;
134+
#endif
135+
136+
#endif
137+
138+
//-------ESP32C3, ESP32S3, ESP32S2---------
139+
140+
#if defined(ESP32) && defined(ESP32X)
141+
# ifdef ARDUINO
142+
# include "esp32-hal-log.h"
143+
# endif
144+
# if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 0 , 0)
145+
# define USE_INT24_FROM_INT
146+
# define USE_ANALOG
147+
# endif
148+
149+
#define USE_PWM
150+
#define USE_URL_ARDUINO
151+
#define USE_WIFI
152+
#define USE_WIFI_CLIENT_SECURE
153+
#define USE_I2S
154+
#define USE_AUDIO_SERVER
155+
#define USE_TYPETRAITS
156+
#define USE_TIMER
157+
#define USE_STREAM_WRITE_OVERRIDE
158+
#define USE_STREAM_READ_OVERRIDE
159+
// support for psram -> set to true
160+
#define USE_ALLOCATOR true
161+
//#define USE_INITIALIZER_LIST
162+
163+
#define PWM_FREQENCY 30000
164+
#define PIN_PWM_START 1
165+
#define PIN_I2S_MCK -1
166+
#define PIN_I2S_BCK 6
167+
#define PIN_I2S_WS 7
168+
#define PIN_I2S_DATA_OUT 8
169+
#define PIN_I2S_DATA_IN 9
170+
// 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
171+
#define PIN_I2S_MUTE -1
172+
#define SOFT_MUTE_VALUE 0
173+
#define PIN_CS SS
174+
#define PIN_ADC1 21
175+
176+
#define I2S_AUTO_CLEAR true
177+
178+
// URLStream
179+
//#define USE_ESP8266_AUDIO
180+
#define URL_STREAM_CORE 0
181+
#define URL_STREAM_PRIORITY 2
182+
#define URL_STREAM_BUFFER_COUNT 10
183+
#define STACK_SIZE 30000
184+
#define URL_CLIENT_TIMEOUT 60000;
185+
#define URL_HANDSHAKE_TIMEOUT 120000
186+
187+
// // Default LED
188+
// #ifndef LED_BUILTIN
189+
// # define LED_BUILTIN 13 // pin number is specific to your esp32 board
190+
// #endif
191+
192+
typedef uint32_t eps32_i2s_sample_rate_type;
193+
194+
#endif
195+
196+
//-------ESP32H2---------
197+
198+
#if defined(ESP32) && defined(CONFIG_IDF_TARGET_ESP32H2)
199+
#include "esp32-hal-log.h"
200+
#if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(5, 0 , 0)
201+
# define USE_INT24_FROM_INT
202+
# define USE_ANALOG
203+
#endif
204+
205+
#define ESP32H2
206+
#define USE_TDM
207+
#define USE_PWM
208+
#define USE_I2S
209+
#define USE_PDM
210+
#define USE_TYPETRAITS
211+
#define USE_TIMER
212+
#define USE_STREAM_WRITE_OVERRIDE
213+
#define USE_STREAM_READ_OVERRIDE
214+
// support for psram -> set to true
215+
#define USE_ALLOCATOR true
216+
//#define USE_INITIALIZER_LIST
217+
218+
#define PWM_FREQENCY 30000
219+
#define PIN_PWM_START 1
220+
#define PIN_I2S_MCK -1
221+
#define PIN_I2S_BCK 6
222+
#define PIN_I2S_WS 7
223+
#define PIN_I2S_DATA_OUT 8
224+
#define PIN_I2S_DATA_IN 9
225+
// 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
226+
#define PIN_I2S_MUTE -1
227+
#define SOFT_MUTE_VALUE 0
228+
#define PIN_CS SS
229+
#define PIN_ADC1 21
230+
#define I2S_AUTO_CLEAR true
231+
232+
typedef uint32_t eps32_i2s_sample_rate_type;
233+
234+
#endif
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#pragma once
2+
3+
#include <ESP8266WiFi.h>
4+
//#define USE_URL_ARDUINO // commented out because of compile errors
5+
#define USE_I2S
6+
#define USE_TYPETRAITS
7+
#define USE_TIMER
8+
#define USE_WIFI
9+
#define USE_AUDIO_SERVER
10+
#define USE_URL_ARDUINO
11+
12+
#define PIN_PWM_START 12
13+
#define PIN_I2S_BCK -1
14+
#define PIN_I2S_WS -1
15+
#define PIN_I2S_DATA_IN -1
16+
#define PIN_I2S_DATA_OUT -1
17+
#define I2S_USE_APLL false
18+
#define PIN_I2S_MUTE 23
19+
#define SOFT_MUTE_VALUE 0
20+
#define PIN_CS SS
21+
#define USE_SERVER_ACCEPT 1
22+
23+
#define URL_CLIENT_TIMEOUT 60000;
24+
#define URL_HANDSHAKE_TIMEOUT 120000
25+
#define USE_SD_SUPPORTS_SPI

src/AudioTools/PlatformConfig/giga.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// DRAFT Support - Not tested !
2+
3+
#pragma once
4+
5+
#include <WiFi.h>
6+
#include <Arduino_AdvancedAnalog.h>
7+
8+
#define IS_MBED
9+
#define USE_INT24_FROM_INT
10+
#define USE_TYPETRAITS
11+
#define USE_ANALOG
12+
#define USE_STREAM_WRITE_OVERRIDE
13+
#define ANALOG_BUFFER_SIZE 1024
14+
#define ANALOG_BUFFERS 10
15+
#define USE_URL_ARDUINO
16+
#define USE_AUDIO_SERVER
17+
18+
#define PIN_ANALOG_START A7
19+
#define PIN_DAC_1 A12
20+
#define PIN_DAC_2 A13

0 commit comments

Comments
 (0)