From be35b83ab997a88242269621cccbe1d17a0a844f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Procha=CC=81zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 22 Aug 2022 12:55:04 +0200 Subject: [PATCH 1/4] add default SPI pins ifndef in arduino_pins.h --- libraries/SPI/src/SPI.cpp | 48 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/libraries/SPI/src/SPI.cpp b/libraries/SPI/src/SPI.cpp index 23a35c0d357..f80af608e68 100644 --- a/libraries/SPI/src/SPI.cpp +++ b/libraries/SPI/src/SPI.cpp @@ -30,6 +30,54 @@ #define SPI_PARAM_UNLOCK() #endif +#ifndef SCK +#if CONFIG_IDF_TARGET_ESP32 +#define SCK 18 +#elif CONFIG_IDF_TARGET_ESP32S2 +#define SCK 36 +#elif CONFIG_IDF_TARGET_ESP32S3 +#define SCK 12 +#elif CONFIG_IDF_TARGET_ESP32C3 +#define SCK 4 +#endif +#endif + +#ifndef MISO +#if CONFIG_IDF_TARGET_ESP32 +#define MISO 19 +#elif CONFIG_IDF_TARGET_ESP32S2 +#define MISO 37 +#elif CONFIG_IDF_TARGET_ESP32S3 +#define MISO 13 +#elif CONFIG_IDF_TARGET_ESP32C3 +#define MISO 5 +#endif +#endif + +#ifndef MOSI +#if CONFIG_IDF_TARGET_ESP32 +#define MOSI 23 +#elif CONFIG_IDF_TARGET_ESP32S2 +#define MOSI 35 +#elif CONFIG_IDF_TARGET_ESP32S3 +#define MOSI 11 +#elif CONFIG_IDF_TARGET_ESP32C3 +#define MOSI 6 +#endif +#endif + +#ifndef SS +#if CONFIG_IDF_TARGET_ESP32 +#define SS 5 +#elif CONFIG_IDF_TARGET_ESP32S2 +#define SS 34 +#elif CONFIG_IDF_TARGET_ESP32S3 +#define SS 10 +#elif CONFIG_IDF_TARGET_ESP32C3 +#define SS 7 +#endif +#endif + SPIClass::SPIClass(uint8_t spi_bus) :_spi_num(spi_bus) ,_spi(NULL) From ff3d5406ffc080acb80561d0cbf748a435b93c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Procha=CC=81zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 29 Aug 2022 13:43:22 +0200 Subject: [PATCH 2/4] Revert "add default SPI pins ifndef in arduino_pins.h" This reverts commit be35b83ab997a88242269621cccbe1d17a0a844f. --- libraries/SPI/src/SPI.cpp | 48 --------------------------------------- 1 file changed, 48 deletions(-) diff --git a/libraries/SPI/src/SPI.cpp b/libraries/SPI/src/SPI.cpp index f80af608e68..23a35c0d357 100644 --- a/libraries/SPI/src/SPI.cpp +++ b/libraries/SPI/src/SPI.cpp @@ -30,54 +30,6 @@ #define SPI_PARAM_UNLOCK() #endif -#ifndef SCK -#if CONFIG_IDF_TARGET_ESP32 -#define SCK 18 -#elif CONFIG_IDF_TARGET_ESP32S2 -#define SCK 36 -#elif CONFIG_IDF_TARGET_ESP32S3 -#define SCK 12 -#elif CONFIG_IDF_TARGET_ESP32C3 -#define SCK 4 -#endif -#endif - -#ifndef MISO -#if CONFIG_IDF_TARGET_ESP32 -#define MISO 19 -#elif CONFIG_IDF_TARGET_ESP32S2 -#define MISO 37 -#elif CONFIG_IDF_TARGET_ESP32S3 -#define MISO 13 -#elif CONFIG_IDF_TARGET_ESP32C3 -#define MISO 5 -#endif -#endif - -#ifndef MOSI -#if CONFIG_IDF_TARGET_ESP32 -#define MOSI 23 -#elif CONFIG_IDF_TARGET_ESP32S2 -#define MOSI 35 -#elif CONFIG_IDF_TARGET_ESP32S3 -#define MOSI 11 -#elif CONFIG_IDF_TARGET_ESP32C3 -#define MOSI 6 -#endif -#endif - -#ifndef SS -#if CONFIG_IDF_TARGET_ESP32 -#define SS 5 -#elif CONFIG_IDF_TARGET_ESP32S2 -#define SS 34 -#elif CONFIG_IDF_TARGET_ESP32S3 -#define SS 10 -#elif CONFIG_IDF_TARGET_ESP32C3 -#define SS 7 -#endif -#endif - SPIClass::SPIClass(uint8_t spi_bus) :_spi_num(spi_bus) ,_spi(NULL) From a65c93f052ed1ac839862c779b5b8cd560089488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Procha=CC=81zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 29 Aug 2022 13:57:49 +0200 Subject: [PATCH 3/4] Add missing default SPI pins --- variants/d32_pro/pins_arduino.h | 4 ++++ variants/metro_esp-32/pins_arduino.h | 5 +++++ variants/wt32-eth01/pins_arduino.h | 10 ++++++++++ 3 files changed, 19 insertions(+) diff --git a/variants/d32_pro/pins_arduino.h b/variants/d32_pro/pins_arduino.h index f19efb977ba..332af7961e4 100644 --- a/variants/d32_pro/pins_arduino.h +++ b/variants/d32_pro/pins_arduino.h @@ -9,6 +9,10 @@ static const uint8_t LED_BUILTIN = 5; #define LED_BUILTIN LED_BUILTIN static const uint8_t _VBAT = 35; // battery voltage +static const uint8_t SS = 5; +static const uint8_t MOSI = 23; +static const uint8_t MISO = 19; +static const uint8_t SCK = 18; #define TF_CS 4 // TF (Micro SD Card) CS pin #define TS_CS 12 // Touch Screen CS pin diff --git a/variants/metro_esp-32/pins_arduino.h b/variants/metro_esp-32/pins_arduino.h index aedf2fb1f71..6675823c50e 100644 --- a/variants/metro_esp-32/pins_arduino.h +++ b/variants/metro_esp-32/pins_arduino.h @@ -22,4 +22,9 @@ static const uint8_t SCL = 22; static const uint8_t ADR = 12; +static const uint8_t SS = 5; +static const uint8_t MOSI = 23; +static const uint8_t MISO = 19; +static const uint8_t SCK = 18; + #endif /* Pins_Arduino_h */ diff --git a/variants/wt32-eth01/pins_arduino.h b/variants/wt32-eth01/pins_arduino.h index 432705fa441..7a7742254a2 100644 --- a/variants/wt32-eth01/pins_arduino.h +++ b/variants/wt32-eth01/pins_arduino.h @@ -52,4 +52,14 @@ static const uint8_t RXD2 = 5, RXD = 5; static const uint8_t TX = 1; static const uint8_t RX = 3; +//SPI VSPI default pins +static const uint8_t SS = -1; +static const uint8_t MOSI = 15; +static const uint8_t MISO = 12; +static const uint8_t SCK = 14; + +//I2C default pins +static const uint8_t SDA = 2; +static const uint8_t SCL = 4; + #endif /* Pins_Arduino_h */ From dec0854209482002917dc4802adc42ee448836cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Procha=CC=81zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Mon, 29 Aug 2022 14:19:43 +0200 Subject: [PATCH 4/4] revert change for d32_pro --- variants/d32_pro/pins_arduino.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/variants/d32_pro/pins_arduino.h b/variants/d32_pro/pins_arduino.h index 332af7961e4..ce36f21bc08 100644 --- a/variants/d32_pro/pins_arduino.h +++ b/variants/d32_pro/pins_arduino.h @@ -9,11 +9,6 @@ static const uint8_t LED_BUILTIN = 5; #define LED_BUILTIN LED_BUILTIN static const uint8_t _VBAT = 35; // battery voltage -static const uint8_t SS = 5; -static const uint8_t MOSI = 23; -static const uint8_t MISO = 19; -static const uint8_t SCK = 18; - #define TF_CS 4 // TF (Micro SD Card) CS pin #define TS_CS 12 // Touch Screen CS pin #define TFT_CS 14 // TFT CS pin