Skip to content

Commit

Permalink
Basic zephyr support
Browse files Browse the repository at this point in the history
  • Loading branch information
pschatzmann committed Dec 7, 2024
1 parent 7aac18f commit 7d53727
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
3 changes: 3 additions & 0 deletions examples/build-arch-log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions examples/build-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 12 additions & 14 deletions src/AudioConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
8 changes: 3 additions & 5 deletions src/AudioTools/CoreAudio/AudioMetaData/MetaDataID3.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
#include <ctype.h>
#include "AbstractMetaData.h"

#ifdef IS_RENESAS
// This is needed for renesas
int isascii(int c);
#endif

/**
* @defgroup metadata-id3 ID3
Expand Down Expand Up @@ -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<m; j++){
if (!isascii(result[j])) {
if (!isCharAscii(result[j])) {
return false;
}
}
Expand Down

0 comments on commit 7d53727

Please sign in to comment.