Skip to content

Add default SPI pin definitions if not defined in pins_arduino.h #7161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 14, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add default SPI pins ifndef in arduino_pins.h
  • Loading branch information
P-R-O-C-H-Y committed Aug 22, 2022
commit be35b83ab997a88242269621cccbe1d17a0a844f
48 changes: 48 additions & 0 deletions libraries/SPI/src/SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down