Skip to content

Commit 2a796af

Browse files
committed
Docs: Added Arduino as IDF component
1 parent 6e3ea9e commit 2a796af

9 files changed

+129
-32
lines changed

README.md

+3-18
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,9 @@ Latest Stable Release [![Release Version](https://img.shields.io/github/release
2020
Latest Development Release [![Release Version](https://img.shields.io/github/release/espressif/arduino-esp32/all.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) [![Release Date](https://img.shields.io/github/release-date-pre/espressif/arduino-esp32.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/) [![Downloads](https://img.shields.io/github/downloads-pre/espressif/arduino-esp32/latest/total.svg?style=plastic)](https://github.com/espressif/arduino-esp32/releases/latest/)
2121

2222

23-
### Installation Instructions
24-
25-
- Using Arduino IDE Boards Manager (preferred)
26-
+ [Instructions for Boards Manager](docs/arduino-ide/boards_manager.md)
27-
- Using Arduino IDE with the development repository
28-
+ [Instructions for Windows](docs/arduino-ide/windows.md)
29-
+ [Instructions for Mac](docs/arduino-ide/mac.md)
30-
+ [Instructions for Debian/Ubuntu Linux](docs/arduino-ide/debian_ubuntu.md)
31-
+ [Instructions for Fedora](docs/arduino-ide/fedora.md)
32-
+ [Instructions for openSUSE](docs/arduino-ide/opensuse.md)
33-
- REMOVE: [Using PlatformIO](docs/platformio.md)
34-
- [Building with make](docs/make.md)
35-
- REMOVE: [Using as ESP-IDF component](docs/esp-idf_component.md)
36-
- [Using OTAWebUpdater](docs/OTAWebUpdate/OTAWebUpdate.md)
23+
### Documentation
24+
25+
You can use [Arduino-ESP32 Online Documentation](https://docs.espressif.com/projects/arduino-esp32/en/docs-structure/index.html) to get all information about this project.
3726

3827
### Decoding exceptions
3928

@@ -43,7 +32,3 @@ You can use [EspExceptionDecoder](https://github.com/me-no-dev/EspExceptionDecod
4332
Before reporting an issue, make sure you've searched for similar one that was already created. Also make sure to go through all the issues labelled as [for reference](https://github.com/espressif/arduino-esp32/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3A%22for%20reference%22%20).
4433

4534
Finally, if you are sure no one else had the issue, follow the [ISSUE_TEMPLATE](docs/ISSUE_TEMPLATE.md) while reporting any issue.
46-
47-
### Tip
48-
49-
Sometimes to program ESP32 via serial you must keep GPIO0 LOW during the programming process

docs/esp-idf_component.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
To use as a component of ESP-IDF
2-
=================================================
2+
================================
33

44
## esp32-arduino-lib-builder
55

docs/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3232
# ones.
3333
extensions = [
34-
'sphinx_copybutton'
34+
# 'sphinx_copybutton'
3535
]
3636

3737
# Add any paths that contain templates here, relative to this directory.

docs/source/esp-idf_component.rst

+91-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,91 @@
1-
ESP-IDF as Component
2-
====================
1+
Arduino as a ESP-IDF component
2+
==============================
3+
4+
ESP32 Arduino lib-builder
5+
-------------------------
6+
7+
For a simplified method, see `lib-builder <lib_builder>`_.
8+
9+
Installation
10+
------------
11+
12+
- Download and install `ESP-IDF <https://github.com/espressif/esp-idf>`_.
13+
- Create blank idf project (from one of the examples).
14+
- in the project folder, create a folder called components and clone this repository inside.
15+
16+
.. code-block:: bash
17+
18+
mkdir -p components && \
19+
cd components && \
20+
git clone https://github.com/espressif/arduino-esp32.git arduino && \
21+
cd arduino && \
22+
git submodule update --init --recursive && \
23+
cd ../.. && \
24+
idf.py menuconfig
25+
26+
27+
- ```idf.py menuconfig``` has some Arduino options
28+
- "Autostart Arduino setup and loop on boot"
29+
- If you enable this options, your main.cpp should be formated like any other sketch
30+
31+
.. code-block:: c
32+
33+
//file: main.cpp
34+
#include "Arduino.h"
35+
36+
void setup(){
37+
Serial.begin(115200);
38+
}
39+
40+
void loop(){
41+
Serial.println("loop");
42+
delay(1000);
43+
}
44+
45+
- Else you need to implement ```app_main()``` and call ```initArduino();``` in it.
46+
47+
Keep in mind that setup() and loop() will not be called in this case.
48+
If you plan to base your code on examples provided in `examples <https://github.com/espressif/esp-idf/tree/master/examples>`_, please make sure move the app_main() function in main.cpp from the files in the example.
49+
50+
.. code-block:: cpp
51+
52+
//file: main.cpp
53+
#include "Arduino.h"
54+
55+
extern "C" void app_main()
56+
{
57+
initArduino();
58+
pinMode(4, OUTPUT);
59+
digitalWrite(4, HIGH);
60+
//do your own thing
61+
}
62+
63+
- "Disable mutex locks for HAL"
64+
- If enabled, there will be no protection on the drivers from concurently accessing them from another thread/interrupt/core
65+
- "Autoconnect WiFi on boot"
66+
- If enabled, WiFi will start with the last known configuration
67+
- Else it will wait for WiFi.begin
68+
69+
- ```idf.py -p <your-board-serial-port> flash monitor``` will build, upload and open serial monitor to your board
70+
71+
Logging To Serial
72+
-----------------
73+
74+
If you are writing code that does not require Arduino to compile and you want your `ESP_LOGx` macros to work in Arduino IDE, you can enable the compatibility by adding the following lines after your includes:
75+
76+
.. code-block:: c
77+
78+
#ifdef ARDUINO_ARCH_ESP32
79+
#include "esp32-hal-log.h"
80+
#endif
81+
82+
FreeRTOS Tick Rate (Hz)
83+
-----------------------
84+
85+
You might notice that Arduino-esp32's `delay()` function will only work in multiples of 10ms. That is because, by default, esp-idf handles task events 100 times per second.
86+
To fix that behavior you need to set FreeRTOS tick rate to 1000Hz in `make menuconfig` -> `Component config` -> `FreeRTOS` -> `Tick rate`.
87+
88+
Compilation Errors
89+
------------------
90+
91+
As commits are made to esp-idf and submodules, the codebases can develop incompatibilities which cause compilation errors. If you have problems compiling, follow the instructions in `Issue #1142 <https://github.com/espressif/arduino-esp32/issues/1142>`_ to roll esp-idf back to a known good version.

docs/source/getting_started.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
***************
21
Getting Started
3-
***************
2+
===============
43

54
About Arduino ESP32
65
-------------------

docs/source/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ Welcome to ESP32 Arduino Core's documentation
1111
Libraries <libraries>
1212
Library Builder <lib_builder>
1313
ESP-IDF as Component <esp-idf_component>
14+
Troubleshooting <troubleshooting>

docs/source/installing.rst

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
**********
21
Installing
3-
**********
2+
==========
43

54
Before Installing
65
-----------------
76

8-
Installing using Boards Manager
9-
-------------------------------
7+
Installing using Boards Manager (preferred way)
8+
-----------------------------------------------
109

1110
- Stable release link::
1211

@@ -38,7 +37,7 @@ Linux
3837
-----
3938

4039
Debian/Ubuntu
41-
===============
40+
-------------
4241

4342
- Install latest Arduino IDE from `arduino.cc`_.
4443

@@ -75,7 +74,7 @@ Debian/Ubuntu
7574
python3 get.py
7675
7776
Fedora
78-
======
77+
------
7978

8079
- Install the latest Arduino IDE from `arduino.cc`_.
8180
- Command ``$ sudo dnf -y install arduino`` will most likely install an older release.
@@ -97,7 +96,7 @@ Fedora
9796
- Restart Arduino IDE.
9897

9998
openSUSE
100-
========
99+
--------
101100

102101
- Install the latest Arduino IDE from `arduino.cc`_.
103102

docs/source/lib_builder.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Library Builder
22
===============
33

44
How to Use Library Builder
5-
**************************
5+
--------------------------
66

77
Espressif has provided a `tool <https://github.com/espressif/esp32-arduino-lib-builder>`_ to simplify building your own compiled libraries for use in Arduino IDE (or your favorite IDE).
88
To use it to generate custom libraries, follow these steps:

docs/source/troubleshooting.rst

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Troubleshotting
2+
###############
3+
4+
Common Issues
5+
=============
6+
7+
Here are some of the most common issues around ESP32 development using Arduino.
8+
9+
.. note:: Please consider contributing if you found any issue with the solution here.
10+
11+
Installing
12+
==========
13+
14+
Building
15+
--------
16+
17+
Flashing
18+
--------
19+
20+
Hardware
21+
--------
22+
23+
- Power Source
24+
- Bad USB cable or charging only cables

0 commit comments

Comments
 (0)