From f81d4a39f53b1c386d7963d66f70d0a7aa9cd0a0 Mon Sep 17 00:00:00 2001 From: Daniel Morgan Date: Tue, 16 Jan 2024 16:24:27 +0100 Subject: [PATCH] changes to support seeed xiao esp32s3 --- UsbCore.h | 2 ++ avrpins.h | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/UsbCore.h b/UsbCore.h index c8715e51..d328a40b 100644 --- a/UsbCore.h +++ b/UsbCore.h @@ -48,6 +48,8 @@ typedef MAX3421e MAX3421E; // Balanduino typedef MAX3421e MAX3421E; // The Intel Galileo supports much faster read and write speed at pin 2 and 3 #elif defined(ESP8266) typedef MAX3421e MAX3421E; // ESP8266 boards +#elif defined(ARDUINO_XIAO_ESP32S3) +typedef MAX3421e MAX3421E; // ESP32 XIAO boards #elif defined(ESP32) typedef MAX3421e MAX3421E; // ESP32 boards #elif defined(MIGHTYCORE) diff --git a/avrpins.h b/avrpins.h index 0f63d31f..29189904 100644 --- a/avrpins.h +++ b/avrpins.h @@ -1661,6 +1661,47 @@ MAKE_PIN(P13, 13); // MOSI MAKE_PIN(P14, 14); // SCK MAKE_PIN(P15, 15); // SS +#elif defined(ARDUINO_XIAO_ESP32S3) + +// Workaround strict-aliasing warnings +#ifdef pgm_read_word +#undef pgm_read_word +#endif +#ifdef pgm_read_dword +#undef pgm_read_dword +#endif +#ifdef pgm_read_float +#undef pgm_read_float +#endif +#ifdef pgm_read_ptr +#undef pgm_read_ptr +#endif + +#define pgm_read_word(addr) ({ \ + typeof(addr) _addr = (addr); \ + *(const unsigned short *)(_addr); \ +}) +#define pgm_read_dword(addr) ({ \ + typeof(addr) _addr = (addr); \ + *(const unsigned long *)(_addr); \ +}) +#define pgm_read_float(addr) ({ \ + typeof(addr) _addr = (addr); \ + *(const float *)(_addr); \ +}) +#define pgm_read_ptr(addr) ({ \ + typeof(addr) _addr = (addr); \ + *(void * const *)(_addr); \ +}) + +// Pinout for ESP32 dev module + +MAKE_PIN(P8, 8); // MISO +MAKE_PIN(P9, 9); // MOSI +MAKE_PIN(P7, 7); // SCK +MAKE_PIN(P44, 44); // SS +MAKE_PIN(P4, 4); // INT + #elif defined(ESP32) // Workaround strict-aliasing warnings