Skip to content

Commit faefadc

Browse files
committed
IDF support
1 parent 04fbf16 commit faefadc

File tree

2 files changed

+11
-42
lines changed

2 files changed

+11
-42
lines changed

src/AudioTools/AudioLibs/Desktop/NoArduino.h

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -184,51 +184,22 @@ inline long map(long x, long in_min, long in_max, long out_min, long out_max) {
184184
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
185185
}
186186

187-
// #ifndef DESKTOP_MILLIS_DEFINED
188-
189-
// /// Waits for the indicated milliseconds
190-
// extern void delay(uint32_t ms);
191-
192-
// /// Returns the milliseconds since the start
193-
// extern uint32_t millis();
194-
195-
// /// Waits for the indicated milliseconds
196-
// extern void delayMicroseconds(uint32_t ms);
197-
198-
// /// Returns the milliseconds since the start
199-
// extern uint32_t micros();
200-
201-
// #else
202-
203-
// extern "C" {
204-
205-
// /// Waits for the indicated milliseconds
206-
// extern void delay(uint32_t ms);
207-
208-
// /// Returns the milliseconds since the start
209-
// extern uint32_t millis();
210-
211-
// /// Waits for the indicated milliseconds
212-
// extern void delayMicroseconds(uint32_t ms);
213-
214-
// /// Returns the milliseconds since the start
215-
// extern uint32_t micros();
216-
217-
// }
218-
219-
// #endif
220-
221187
} // namespace audio_tools
222188

223189
#if defined(ESP32)
224190
#include "driver/gpio.h"
191+
225192
/// e.g. for AudioActions
226-
static int digitalRead(int pin) {
193+
extern "C" int digitalRead(int pin) {
227194
printf("digitalRead:%d\n", pin);
228195
return gpio_get_level((gpio_num_t)pin);
229196
}
230197

231-
static void pinMode(int pin, int mode) {
198+
extern "C" void digitalWrite(int pin, int value) {
199+
gpio_set_level((gpio_num_t)pin, value);
200+
}
201+
202+
extern "C" void pinMode(int pin, int mode) {
232203
gpio_num_t gpio_pin = (gpio_num_t)pin;
233204
printf("pinMode(%d,%d)\n", pin, mode);
234205

@@ -251,5 +222,3 @@ static void pinMode(int pin, int mode) {
251222
}
252223

253224
#endif
254-
255-
// using namespace audio_tools;

src/AudioTools/CoreAudio/AudioRuntime.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
// delay and millis is needed by this framework
1010
#define DESKTOP_MILLIS_DEFINED
1111

12-
inline void delay(uint32_t ms){ vTaskDelay(ms / portTICK_PERIOD_MS);}
13-
inline uint32_t millis() {return (xTaskGetTickCount() * portTICK_PERIOD_MS);}
14-
inline void delayMicroseconds(uint32_t ms) {esp_rom_delay_us(ms);}
15-
inline uint64_t micros() { return xTaskGetTickCount() * portTICK_PERIOD_MS * 1000;}
12+
extern "C" void delay(uint32_t ms){ vTaskDelay(ms / portTICK_PERIOD_MS);}
13+
extern "C" uint32_t millis() {return (xTaskGetTickCount() * portTICK_PERIOD_MS);}
14+
extern "C" void delayMicroseconds(uint32_t ms) {esp_rom_delay_us(ms);}
15+
extern "C" uint64_t micros() { return xTaskGetTickCount() * portTICK_PERIOD_MS * 1000;}
1616

1717
#endif
1818

0 commit comments

Comments
 (0)