Skip to content

Commit be35b83

Browse files
committed
add default SPI pins ifndef in arduino_pins.h
1 parent fe1d9e0 commit be35b83

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

Diff for: libraries/SPI/src/SPI.cpp

+48
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,54 @@
3030
#define SPI_PARAM_UNLOCK()
3131
#endif
3232

33+
#ifndef SCK
34+
#if CONFIG_IDF_TARGET_ESP32
35+
#define SCK 18
36+
#elif CONFIG_IDF_TARGET_ESP32S2
37+
#define SCK 36
38+
#elif CONFIG_IDF_TARGET_ESP32S3
39+
#define SCK 12
40+
#elif CONFIG_IDF_TARGET_ESP32C3
41+
#define SCK 4
42+
#endif
43+
#endif
44+
45+
#ifndef MISO
46+
#if CONFIG_IDF_TARGET_ESP32
47+
#define MISO 19
48+
#elif CONFIG_IDF_TARGET_ESP32S2
49+
#define MISO 37
50+
#elif CONFIG_IDF_TARGET_ESP32S3
51+
#define MISO 13
52+
#elif CONFIG_IDF_TARGET_ESP32C3
53+
#define MISO 5
54+
#endif
55+
#endif
56+
57+
#ifndef MOSI
58+
#if CONFIG_IDF_TARGET_ESP32
59+
#define MOSI 23
60+
#elif CONFIG_IDF_TARGET_ESP32S2
61+
#define MOSI 35
62+
#elif CONFIG_IDF_TARGET_ESP32S3
63+
#define MOSI 11
64+
#elif CONFIG_IDF_TARGET_ESP32C3
65+
#define MOSI 6
66+
#endif
67+
#endif
68+
69+
#ifndef SS
70+
#if CONFIG_IDF_TARGET_ESP32
71+
#define SS 5
72+
#elif CONFIG_IDF_TARGET_ESP32S2
73+
#define SS 34
74+
#elif CONFIG_IDF_TARGET_ESP32S3
75+
#define SS 10
76+
#elif CONFIG_IDF_TARGET_ESP32C3
77+
#define SS 7
78+
#endif
79+
#endif
80+
3381
SPIClass::SPIClass(uint8_t spi_bus)
3482
:_spi_num(spi_bus)
3583
,_spi(NULL)

0 commit comments

Comments
 (0)