Skip to content

Commit 7c42c0c

Browse files
authored
Merge branch 'master' into wifi_config_arduino_auto
2 parents c99bf96 + 654aead commit 7c42c0c

File tree

4 files changed

+78
-32
lines changed

4 files changed

+78
-32
lines changed

docs/en/guides/core_compatibility.rst

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Compatibility Guide for ESP32 Arduino Core
2+
==========================================
3+
4+
Introduction
5+
------------
6+
7+
Welcome to the compatibility guide for library developers aiming to support multiple versions of the ESP32 Arduino core. This documentation provides essential tips and best practices for ensuring compatibility with 2.x, 3.x and future versions of the ESP32 Arduino core.
8+
9+
Code Adaptations
10+
----------------
11+
12+
To ensure compatibility with both versions of the ESP32 Arduino core, developers should utilize conditional compilation directives in their code. Below is an example of how to conditionally include code based on the ESP32 Arduino core version::
13+
14+
.. code-block:: cpp
15+
16+
#ifdef ESP_ARDUINO_VERSION_MAJOR
17+
#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0)
18+
// Code for version 3.x
19+
#else
20+
// Code for version 2.x
21+
#endif
22+
#else
23+
// Code for version 1.x
24+
#endif
25+
26+
Version Print
27+
-------------
28+
29+
To easily print the ESP32 Arduino core version at runtime, developers can use the `ESP_ARDUINO_VERSION_STR` macro. Below is an example of how to print the ESP32 Arduino core version::
30+
31+
.. code-block:: cpp
32+
33+
Serial.printf(" ESP32 Arduino core version: %s\n", ESP_ARDUINO_VERSION_STR);
34+
35+
API Differences
36+
---------------
37+
38+
Developers should be aware, that there may be API differences between major versions of the ESP32 Arduino core. For this we created a `Migration guide <https://docs.espressif.com/projects/arduino-esp32/en/latest/migration_guides.html>`_. to help developers transition from between major versions of the ESP32 Arduino core.
39+
40+
Library Testing
41+
---------------
42+
43+
We have added an External Library Test CI job, which tests external libraries with the latest version of the ESP32 Arduino core to help developers ensure compatibility with the latest version of the ESP32 Arduino core.
44+
If you want to include your library in the External Library Test CI job, please follow the instructions in the `External Libraries Test <https://docs.espressif.com/projects/arduino-esp32/en/latest/esp32/external_libraries_test.html>`_.

libraries/SD/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ Some ESP32 modules have different pin outs!
1818
## Default SPI pins:
1919
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)`
2020

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

2828
## FAQ:
2929

libraries/SD/examples/SD_Test/SD_Test.ino

+14-13
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222
* Note: The SPI pins can be manually configured by using `SPI.begin(sck, miso, mosi, cs).`
2323
* Alternatively, you can change the CS pin and use the other default settings by using `SD.begin(cs)`.
2424
*
25-
* +--------------+---------+-------+----------+----------+----------+
26-
* | SPI Pin Name | ESP8266 | ESP32 | ESP32-S2 | ESP32-C3 | ESP32-S3 |
27-
* +==============+=========+=======+==========+==========+==========+
28-
* | CS (SS) | GPIO15 | GPIO5 | GPIO5 | GPIO13 | GPIO13 |
29-
* +--------------+---------+-------+----------+----------+----------+
30-
* | DI (MOSI) | GPIO13 | GPIO23| GPIO24 | GPIO14 | GPIO14 |
31-
* +--------------+---------+-------+----------+----------+----------+
32-
* | DO (MISO) | GPIO12 | GPIO19| GPIO25 | GPIO15 | GPIO15 |
33-
* +--------------+---------+-------+----------+----------+----------+
34-
* | SCK (SCLK) | GPIO14 | GPIO18| GPIO19 | GPIO16 | GPIO16 |
35-
* +--------------+---------+-------+----------+----------+----------+
25+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
26+
* | SPI Pin Name | ESP8266 | ESP32 | ESP32S2 | ESP32‑S3 | ESP32‑C3 | ESP32‑C6 | ESP32‑H2 |
27+
* +==============+=========+=======+==========+==========+==========+==========+==========+
28+
* | CS (SS) | GPIO15 | GPIO5 | GPIO34 | GPIO10 | GPIO7 | GPIO18 | GPIO0 |
29+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
30+
* | DI (MOSI) | GPIO13 | GPIO23| GPIO35 | GPIO11 | GPIO6 | GPIO19 | GPIO25 |
31+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
32+
* | DO (MISO) | GPIO12 | GPIO19| GPIO37 | GPIO13 | GPIO5 | GPIO20 | GPIO11 |
33+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
34+
* | SCK (SCLK) | GPIO14 | GPIO18| GPIO36 | GPIO12 | GPIO4 | GPIO21 | GPIO10 |
35+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
3636
*
3737
* For more info see file README.md in this library or on URL:
3838
* https://github.com/espressif/arduino-esp32/tree/master/libraries/SD
@@ -214,9 +214,10 @@ void setup(){
214214

215215
#ifdef REASSIGN_PINS
216216
SPI.begin(sck, miso, mosi, cs);
217-
#endif
218-
//if(!SD.begin(cs)){ //Change to this function to manually change CS pin
217+
if(!SD.begin(cs)){
218+
#else
219219
if(!SD.begin()){
220+
#endif
220221
Serial.println("Card Mount Failed");
221222
return;
222223
}

libraries/SD/examples/SD_time/SD_time.ino

+14-13
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222
* Note: The SPI pins can be manually configured by using `SPI.begin(sck, miso, mosi, cs);`.
2323
* Alternatively you can change only the CS pin with `SD.begin(CSpin)` and keep the default settings for other pins.
2424
*
25-
* +--------------+---------+-------+----------+----------+----------+
26-
* | SPI Pin Name | ESP8266 | ESP32 | ESP32-S2 | ESP32-C3 | ESP32-S3 |
27-
* +==============+=========+=======+==========+==========+==========+
28-
* | CS (SS) | GPIO15 | GPIO5 | GPIO5 | GPIO13 | GPIO13 |
29-
* +--------------+---------+-------+----------+----------+----------+
30-
* | DI (MOSI) | GPIO13 | GPIO23| GPIO24 | GPIO14 | GPIO14 |
31-
* +--------------+---------+-------+----------+----------+----------+
32-
* | DO (MISO) | GPIO12 | GPIO19| GPIO25 | GPIO15 | GPIO15 |
33-
* +--------------+---------+-------+----------+----------+----------+
34-
* | SCK (SCLK) | GPIO14 | GPIO18| GPIO19 | GPIO16 | GPIO16 |
35-
* +--------------+---------+-------+----------+----------+----------+
25+
+----------+
26+
* | SPI Pin Name | ESP8266 | ESP32 | ESP32S2 | ESP32‑S3 | ESP32‑C3 | ESP32‑C6 | ESP32‑H2 |
27+
* +==============+=========+=======+==========+==========+==========+==========+==========+
28+
* | CS (SS) | GPIO15 | GPIO5 | GPIO34 | GPIO10 | GPIO7 | GPIO18 | GPIO0 |
29+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
30+
* | DI (MOSI) | GPIO13 | GPIO23| GPIO35 | GPIO11 | GPIO6 | GPIO19 | GPIO25 |
31+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
32+
* | DO (MISO) | GPIO12 | GPIO19| GPIO37 | GPIO13 | GPIO5 | GPIO20 | GPIO11 |
33+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
34+
* | SCK (SCLK) | GPIO14 | GPIO18| GPIO36 | GPIO12 | GPIO4 | GPIO21 | GPIO10 |
35+
* +--------------+---------+-------+----------+----------+----------+----------+----------+
3636
*
3737
* For more info see file README.md in this library or on URL:
3838
* https://github.com/espressif/arduino-esp32/tree/master/libraries/SD
@@ -208,9 +208,10 @@ void setup(){
208208

209209
#ifdef REASSIGN_PINS
210210
SPI.begin(sck, miso, mosi, cs);
211-
#endif
212-
//if(!SD.begin(cs)){ //Change to this function to manually change CS pin
211+
if(!SD.begin(cs)){
212+
#else
213213
if(!SD.begin()){
214+
#endif
214215
Serial.println("Card Mount Failed");
215216
return;
216217
}

0 commit comments

Comments
 (0)