From 7d53727407b645f9ab5335467c00b47cf8fb7a55 Mon Sep 17 00:00:00 2001 From: pschatzmann Date: Sat, 7 Dec 2024 08:08:43 +0100 Subject: [PATCH] Basic zephyr support --- examples/build-arch-log.txt | 3 +++ examples/build-arch.sh | 5 ++-- src/AudioConfig.h | 26 +++++++++---------- .../CoreAudio/AudioMetaData/MetaDataID3.h | 8 +++--- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/examples/build-arch-log.txt b/examples/build-arch-log.txt index 27c4eb941c..a6909016a3 100644 --- a/examples/build-arch-log.txt +++ b/examples/build-arch-log.txt @@ -9,3 +9,6 @@ rp2040:rp2040:generic ./examples-stream/streams-generator-serial -> rc=0 arduino:avr:nano ./examples-stream/streams-generator-serial -> rc=0 arduino:samd:arduino_zero_native ./examples-stream/streams-generator-serial -> rc=0 arduino:renesas_uno:unor4wifi ./examples-stream/streams-generator-serial -> rc=0 +arduino:mbed_nano:nano33ble ./examples-stream/streams-generator-serial -> rc=0 +arduino:zephyr:nano33ble ./examples-stream/streams-generator-serial -> rc=0 +arduino:mbed_rp2040:pico ./examples-stream/streams-generator-serial -> rc=0 diff --git a/examples/build-arch.sh b/examples/build-arch.sh index cafe93eaee..6e3f3dea9b 100755 --- a/examples/build-arch.sh +++ b/examples/build-arch.sh @@ -29,8 +29,9 @@ compile_example "rp2040:rp2040:generic" compile_example "arduino:avr:nano" compile_example "arduino:samd:arduino_zero_native" compile_example "arduino:renesas_uno:unor4wifi" -#compile_example "arduino:mbed_nano:nanorp2040connect" -#compile_example "arduino:mbed_rp2040:pico" +compile_example "arduino:mbed_nano:nano33ble" +compile_example "arduino:zephyr:nano33ble" +compile_example "arduino:mbed_rp2040:pico" #compile_example "STMicroelectronics:stm32:GenF4" ./cleanup.sh diff --git a/src/AudioConfig.h b/src/AudioConfig.h index 49b21a6c48..9d9d098dcf 100644 --- a/src/AudioConfig.h +++ b/src/AudioConfig.h @@ -286,7 +286,6 @@ typedef WiFiClient WiFiClientSecure; #endif #define USE_TYPETRAITS -#define USE_EFFECTS_SUITE #define USE_STREAM_WRITE_OVERRIDE #define USE_STREAM_READ_OVERRIDE #define USE_TOUCH_READ @@ -356,7 +355,6 @@ typedef uint32_t eps32_i2s_sample_rate_type; #define USE_I2S #define USE_AUDIO_SERVER #define USE_TYPETRAITS -#define USE_EFFECTS_SUITE #define USE_TIMER #define USE_STREAM_WRITE_OVERRIDE #define USE_STREAM_READ_OVERRIDE @@ -413,7 +411,6 @@ typedef uint32_t eps32_i2s_sample_rate_type; #define USE_I2S #define USE_PDM #define USE_TYPETRAITS -#define USE_EFFECTS_SUITE #define USE_TIMER #define USE_STREAM_WRITE_OVERRIDE #define USE_STREAM_READ_OVERRIDE @@ -447,7 +444,6 @@ typedef uint32_t eps32_i2s_sample_rate_type; //#define USE_URL_ARDUINO // commented out because of compile errors #define USE_I2S #define USE_TYPETRAITS -#define USE_EFFECTS_SUITE #define USE_TIMER #define USE_WIFI #define USE_AUDIO_SERVER @@ -471,13 +467,12 @@ typedef uint32_t eps32_i2s_sample_rate_type; #endif //------ NANO33BLE ---------- -#if defined(ARDUINO_SEEED_XIAO_NRF52840_SENSE) || defined(ARDUINO_ARDUINO_NANO33BLE) +#if (defined(ARDUINO_SEEED_XIAO_NRF52840_SENSE) || defined(ARDUINO_ARDUINO_NANO33BLE) || defined(ARDUINO_ARCH_MBED_NANO)) && !defined(ARDUINO_ARCH_ZEPHYR) #define USE_NANO33BLE #define USE_INT24_FROM_INT #define USE_I2S #define USE_PWM #define USE_TYPETRAITS -#define USE_EFFECTS_SUITE #define USE_TIMER //#define USE_INITIALIZER_LIST #define USE_ALT_PIN_SUPPORT @@ -493,15 +488,14 @@ typedef uint32_t eps32_i2s_sample_rate_type; #define PIN_CS SS #endif -//----- MBED ----------- -#if defined(ARDUINO_ARCH_MBED_RP2040) || defined(ARDUINO_ARCH_MBED_NANO) +//----- RP2040 MBED ----------- +#if defined(ARDUINO_ARCH_MBED_RP2040) // install https://github.com/pschatzmann/rp2040-i2s #define RP2040_MBED #define USE_I2S 1 #define USE_PWM #define USE_ANALOG_ARDUINO #define USE_TYPETRAITS -#define USE_EFFECTS_SUITE #define USE_TIMER #define USE_INT24_FROM_INT @@ -537,7 +531,6 @@ typedef uint32_t eps32_i2s_sample_rate_type; #define USE_PWM #define USE_ANALOG_ARDUINO #define USE_TYPETRAITS -#define USE_EFFECTS_SUITE #define USE_TIMER #define USE_INT24_FROM_INT @@ -566,7 +559,7 @@ typedef uint32_t eps32_i2s_sample_rate_type; #define ANALOG_BUFFERS 100 #endif -#define USE_CONCURRENCY +//#define USE_CONCURRENCY #define USE_SD_SUPPORTS_SPI // default pins for VS1053 shield @@ -695,7 +688,6 @@ using WiFiServerSecure = BearSSL::WiFiServerSecure; #define IS_MBED #define USE_INT24_FROM_INT #define USE_TYPETRAITS -#define USE_EFFECTS_SUITE #define USE_ANALOG #define USE_STREAM_WRITE_OVERRIDE #define ANALOG_BUFFER_SIZE 1024 @@ -717,7 +709,6 @@ using WiFiServerSecure = BearSSL::WiFiServerSecure; #define IS_MBED #define USE_INT24_FROM_INT #define USE_TYPETRAITS -#define USE_EFFECTS_SUITE #define USE_ANALOG #define USE_TIMER #define USE_PWM @@ -743,7 +734,6 @@ using WiFiServerSecure = BearSSL::WiFiServerSecure; #define USE_INT24_FROM_INT #define IS_RENESAS 1 #define USE_TYPETRAITS -#define USE_EFFECTS_SUITE #define USE_TIMER #define USE_PWM #define PIN_PWM_START D2 @@ -774,6 +764,13 @@ using WiFiServerSecure = BearSSL::WiFiServerSecure; #endif + +// ------ Zephyr ------- +#ifdef ARDUINO_ARCH_ZEPHYR +# define IS_ZEPHYR +# define NO_INPLACE_INIT_SUPPORT +#endif + //------ VS1053 ---------- // see https://github.com/pschatzmann/arduino-vs1053/wiki/Pinouts-for-Processors-and-Tested-Boards#microcontrollers // Default Pins for VS1053 @@ -840,6 +837,7 @@ using WiFiServerSecure = BearSSL::WiFiServerSecure; #pragma GCC diagnostic ignored "-Wvla" #pragma GCC diagnostic ignored "-Wsign-compare" #pragma GCC diagnostic ignored "-Woverloaded-virtual" +#pragma GCC diagnostic ignored "-Wdouble-promotion" #ifdef USE_NO_MEMACCESS #pragma GCC diagnostic ignored "-Wclass-memaccess" diff --git a/src/AudioTools/CoreAudio/AudioMetaData/MetaDataID3.h b/src/AudioTools/CoreAudio/AudioMetaData/MetaDataID3.h index 9cfbd4d007..fe249ff99a 100644 --- a/src/AudioTools/CoreAudio/AudioMetaData/MetaDataID3.h +++ b/src/AudioTools/CoreAudio/AudioMetaData/MetaDataID3.h @@ -11,10 +11,6 @@ #include #include "AbstractMetaData.h" -#ifdef IS_RENESAS -// This is needed for renesas -int isascii(int c); -#endif /** * @defgroup metadata-id3 ID3 @@ -473,13 +469,15 @@ class MetaDataID3V2 : public MetaDataID3Base { total_len += len; } + + int isCharAscii(int ch) {return ch >= 0 && ch < 128; } /// Make sure that the result is a valid ASCII string bool isAscii(int l){ // check on first 10 characters int m = l < 5 ? l : 10; for (int j=0; j