Skip to content

Commit

Permalink
Matched pin numbers in doco to numbers in variants files (#9422)
Browse files Browse the repository at this point in the history
* Matched pin numbers in doco to numbers in variants files

* Non-breaking dashes

* Changed SD examples to make REASSIGN_PINS more transparent. Fixes #9082

---------

Co-authored-by: Jan Procházka <[email protected]>
  • Loading branch information
lbernstone and P-R-O-C-H-Y authored Mar 27, 2024
1 parent 91c9ecd commit 654aead
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 32 deletions.
12 changes: 6 additions & 6 deletions libraries/SD/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ Some ESP32 modules have different pin outs!
## Default SPI pins:
Note that SPI pins can be configured by using `SPI.begin(sck, miso, mosi, cs);` alternatively, you can change only the CS pin with `SD.begin(CSpin)`

| SPI Pin Name | ESP8266 | ESP32 | ESP32-S2 | ESP32-C3 | ESP32-S3 |
|--------------|---------|-------|----------|----------|----------|
| CS (SS) | GPIO15 | GPIO5 | GPIO5 | GPIO13 | GPIO13 |
| DI (MOSI) | GPIO13 | GPIO23| GPIO24 | GPIO14 | GPIO14 |
| DO (MISO) | GPIO12 | GPIO19| GPIO25 | GPIO15 | GPIO15 |
| SCK (SCLK) | GPIO14 | GPIO18| GPIO19 | GPIO16 | GPIO16 |
| SPI Pin Name | ESP8266 | ESP32 | ESP32S2 | ESP32‑S3 | ESP32‑C3 | ESP32‑C6 | ESP32‑H2 |
|--------------|---------|-------|----------|----------|----------|----------|----------|
| CS (SS) | GPIO15 | GPIO5 | GPIO34 | GPIO10 | GPIO7 | GPIO18 | GPIO0 |
| DI (MOSI) | GPIO13 | GPIO23| GPIO35 | GPIO11 | GPIO6 | GPIO19 | GPIO25 |
| DO (MISO) | GPIO12 | GPIO19| GPIO37 | GPIO13 | GPIO5 | GPIO20 | GPIO11 |
| SCK (SCLK) | GPIO14 | GPIO18| GPIO36 | GPIO12 | GPIO4 | GPIO21 | GPIO10 |

## FAQ:

Expand Down
27 changes: 14 additions & 13 deletions libraries/SD/examples/SD_Test/SD_Test.ino
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
* Note: The SPI pins can be manually configured by using `SPI.begin(sck, miso, mosi, cs).`
* Alternatively, you can change the CS pin and use the other default settings by using `SD.begin(cs)`.
*
* +--------------+---------+-------+----------+----------+----------+
* | SPI Pin Name | ESP8266 | ESP32 | ESP32-S2 | ESP32-C3 | ESP32-S3 |
* +==============+=========+=======+==========+==========+==========+
* | CS (SS) | GPIO15 | GPIO5 | GPIO5 | GPIO13 | GPIO13 |
* +--------------+---------+-------+----------+----------+----------+
* | DI (MOSI) | GPIO13 | GPIO23| GPIO24 | GPIO14 | GPIO14 |
* +--------------+---------+-------+----------+----------+----------+
* | DO (MISO) | GPIO12 | GPIO19| GPIO25 | GPIO15 | GPIO15 |
* +--------------+---------+-------+----------+----------+----------+
* | SCK (SCLK) | GPIO14 | GPIO18| GPIO19 | GPIO16 | GPIO16 |
* +--------------+---------+-------+----------+----------+----------+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
* | SPI Pin Name | ESP8266 | ESP32 | ESP32S2 | ESP32‑S3 | ESP32‑C3 | ESP32‑C6 | ESP32‑H2 |
* +==============+=========+=======+==========+==========+==========+==========+==========+
* | CS (SS) | GPIO15 | GPIO5 | GPIO34 | GPIO10 | GPIO7 | GPIO18 | GPIO0 |
* +--------------+---------+-------+----------+----------+----------+----------+----------+
* | DI (MOSI) | GPIO13 | GPIO23| GPIO35 | GPIO11 | GPIO6 | GPIO19 | GPIO25 |
* +--------------+---------+-------+----------+----------+----------+----------+----------+
* | DO (MISO) | GPIO12 | GPIO19| GPIO37 | GPIO13 | GPIO5 | GPIO20 | GPIO11 |
* +--------------+---------+-------+----------+----------+----------+----------+----------+
* | SCK (SCLK) | GPIO14 | GPIO18| GPIO36 | GPIO12 | GPIO4 | GPIO21 | GPIO10 |
* +--------------+---------+-------+----------+----------+----------+----------+----------+
*
* For more info see file README.md in this library or on URL:
* https://github.com/espressif/arduino-esp32/tree/master/libraries/SD
Expand Down Expand Up @@ -214,9 +214,10 @@ void setup(){

#ifdef REASSIGN_PINS
SPI.begin(sck, miso, mosi, cs);
#endif
//if(!SD.begin(cs)){ //Change to this function to manually change CS pin
if(!SD.begin(cs)){
#else
if(!SD.begin()){
#endif
Serial.println("Card Mount Failed");
return;
}
Expand Down
27 changes: 14 additions & 13 deletions libraries/SD/examples/SD_time/SD_time.ino
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
* Note: The SPI pins can be manually configured by using `SPI.begin(sck, miso, mosi, cs);`.
* Alternatively you can change only the CS pin with `SD.begin(CSpin)` and keep the default settings for other pins.
*
* +--------------+---------+-------+----------+----------+----------+
* | SPI Pin Name | ESP8266 | ESP32 | ESP32-S2 | ESP32-C3 | ESP32-S3 |
* +==============+=========+=======+==========+==========+==========+
* | CS (SS) | GPIO15 | GPIO5 | GPIO5 | GPIO13 | GPIO13 |
* +--------------+---------+-------+----------+----------+----------+
* | DI (MOSI) | GPIO13 | GPIO23| GPIO24 | GPIO14 | GPIO14 |
* +--------------+---------+-------+----------+----------+----------+
* | DO (MISO) | GPIO12 | GPIO19| GPIO25 | GPIO15 | GPIO15 |
* +--------------+---------+-------+----------+----------+----------+
* | SCK (SCLK) | GPIO14 | GPIO18| GPIO19 | GPIO16 | GPIO16 |
* +--------------+---------+-------+----------+----------+----------+
+----------+
* | SPI Pin Name | ESP8266 | ESP32 | ESP32S2 | ESP32‑S3 | ESP32‑C3 | ESP32‑C6 | ESP32‑H2 |
* +==============+=========+=======+==========+==========+==========+==========+==========+
* | CS (SS) | GPIO15 | GPIO5 | GPIO34 | GPIO10 | GPIO7 | GPIO18 | GPIO0 |
* +--------------+---------+-------+----------+----------+----------+----------+----------+
* | DI (MOSI) | GPIO13 | GPIO23| GPIO35 | GPIO11 | GPIO6 | GPIO19 | GPIO25 |
* +--------------+---------+-------+----------+----------+----------+----------+----------+
* | DO (MISO) | GPIO12 | GPIO19| GPIO37 | GPIO13 | GPIO5 | GPIO20 | GPIO11 |
* +--------------+---------+-------+----------+----------+----------+----------+----------+
* | SCK (SCLK) | GPIO14 | GPIO18| GPIO36 | GPIO12 | GPIO4 | GPIO21 | GPIO10 |
* +--------------+---------+-------+----------+----------+----------+----------+----------+
*
* For more info see file README.md in this library or on URL:
* https://github.com/espressif/arduino-esp32/tree/master/libraries/SD
Expand Down Expand Up @@ -208,9 +208,10 @@ void setup(){

#ifdef REASSIGN_PINS
SPI.begin(sck, miso, mosi, cs);
#endif
//if(!SD.begin(cs)){ //Change to this function to manually change CS pin
if(!SD.begin(cs)){
#else
if(!SD.begin()){
#endif
Serial.println("Card Mount Failed");
return;
}
Expand Down

0 comments on commit 654aead

Please sign in to comment.