Skip to content

Commit 399f4ec

Browse files
[DOCS] Editing usage of Arduino as a component in ESP-IDF (#5896)
* Editing esp-idf_component docs * Changed idt to ESP-IDF Co-authored-by: Pedro Minatel <[email protected]>
1 parent a5002c8 commit 399f4ec

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

Diff for: docs/source/esp-idf_component.rst

+24-8
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ Arduino as a ESP-IDF component
55
ESP32 Arduino lib-builder
66
-------------------------
77

8-
For a simplified method, see `lib-builder <lib_builder>`_.
8+
For a simplified method, see `lib-builder <https://github.com/espressif/esp32-arduino-lib-builder>`_.
99

1010
Installation
1111
------------
1212

13-
.. note:: Latest Arduino Core ESP32 version is now compatible with [ESP-IDF v4.4](https://github.com/espressif/esp-idf/tree/release/v4.4). Please consider this compability when using Arduino as component in ESP-IDF.
13+
.. note:: Latest Arduino Core ESP32 version is now compatible with `ESP-IDF v4.4 <https://github.com/espressif/esp-idf/tree/release/v4.4>`_. Please consider this compability when using Arduino as component in ESP-IDF.
1414

1515
- Download and install `ESP-IDF <https://github.com/espressif/esp-idf>`_.
16-
- Create blank idf project (from one of the examples).
16+
- Create blank ESP-IDF project (use sample_project from /examples/get-started) or choose one of the examples.
1717
- In the project folder, create a new folder called `components` and clone this repository inside the new created folder.
1818

1919
.. code-block:: bash
@@ -26,10 +26,19 @@ Installation
2626
cd ../.. && \
2727
idf.py menuconfig
2828
29+
Option 1. Using Arduino setup() and loop()
30+
******************************************
2931

3032
- The `idf.py menuconfig` has some Arduino options.
31-
- On `Autostart Arduino setup and loop on boot`.
32-
- If you enable these options, your main.cpp should be formated like any other sketch.
33+
- Turn on `Autostart Arduino setup and loop on boot`.
34+
- In main folder rename file `main.c` to `main.cpp`.
35+
- In main folder open file `CMakeList.txt` and change `main.c` to `main.cpp` as described below.
36+
37+
.. code-block:: bash
38+
39+
idf_component_register(SRCS "main.cpp" INCLUDE_DIRS ".")
40+
41+
- Your main.cpp should be formated like any other sketch.
3342

3443
.. code-block:: c
3544
@@ -45,14 +54,17 @@ Installation
4554
delay(1000);
4655
}
4756
48-
- Otherwise, you need to implement ```app_main()``` and call ```initArduino();``` in it.
57+
Option 2. Using ESP-IDF appmain()
58+
*********************************
59+
60+
- You need to implement ``app_main()`` and call ``initArduino();`` in it.
4961

5062
Keep in mind that setup() and loop() will not be called in this case.
5163
If you plan to base your code on examples provided in `examples <https://github.com/espressif/esp-idf/tree/master/examples>`_, please make sure to move the app_main() function in main.cpp from the files in the example.
5264

5365
.. code-block:: cpp
5466
55-
//file: main.cpp
67+
//file: main.c or main.cpp
5668
#include "Arduino.h"
5769
5870
extern "C" void app_main()
@@ -69,7 +81,11 @@ If you plan to base your code on examples provided in `examples <https://github.
6981
- If enabled, WiFi will start with the last known configuration
7082
- Otherwise it will wait for WiFi.begin
7183

72-
- ```idf.py -p <your-board-serial-port> flash monitor``` will build, upload and open serial monitor to your board
84+
Build, flash and monitor
85+
************************
86+
87+
- For both options use command ``idf.py -p <your-board-serial-port> flash monitor``
88+
- It will build, upload and open serial monitor to your board.
7389

7490
Logging To Serial
7591
-----------------

0 commit comments

Comments
 (0)