@@ -6,10 +6,13 @@ Not everything is working yet, you can not get it through package manager, but y
66
77The framework can also be downloaded as component in an IDF project and be used like that.
88
9- Things that "should" work:
9+ Things that work:
10+
1011- pinMode
1112- digitalRead/digitalWrite
1213- attachInterrupt/detachInterrupt
14+ - analogRead/touchRead/touchAttachInterrupt
15+ - ledcWrite/sdWrite/dacWrite
1316- Serial (global Serial is attached to pins 1 and 3 by default, there are another 2 serials that you can attach to any pin)
1417- SPI (global SPI is attached to VSPI pins by default and HSPI can be attached to any pins)
1518- Wire (global Wire is attached to pins 21 and 22 by default and there is another I2C bus that you can attach to any pins)
@@ -56,4 +59,57 @@ You can try WiFiClient but you need to disconnect the client yourself to be sure
5659 ```
5760- Restart Arduino IDE
5861
62+ #### Instructions for using as esp-idf component
63+ - Download and install [ esp-idf] ( https://github.com/espressif/esp-idf )
64+ - Create blank idf project (from one of the examples)
65+ - in the project folder, create a folder called components and clone this repository inside
66+
67+ ``` bash
68+ mkdir -p components && \
69+ cd components && \
70+ git clone https://github.com/espressif/arduino-esp32.git arduino && \
71+ cd.. && \
72+ make menuconfig
73+ ```
74+ - ``` make menuconfig ``` has some Arduino options
75+ - "Autostart Arduino setup and loop on boot"
76+ - If you enable this options, your main.cpp should be formated like any other sketch
77+
78+ ```arduino
79+ //file: main.cpp
80+ #include "Arduino.h"
81+
82+ void setup(){
83+ Serial.begin(115200);
84+ }
85+
86+ void loop(){
87+ Serial.println("loop");
88+ delay(1000);
89+ }
90+ ```
91+ - Else you need to implement ``` app_main() ``` and call ``` initArduino(); ``` in it.
92+
93+ Keep in mind that setup() and loop() will not be called in this case
94+
95+ ```arduino
96+ //file: main.cpp
97+ #include "Arduino.h"
98+ extern "C" void initArduino();
99+
100+ extern "C" void app_main()
101+ {
102+ initArduino();
103+ pinMode(4, OUPUT);
104+ digitalWrite(4, HIGH);
105+ //do your own thing
106+ }
107+ ```
108+ - "Disable mutex locks for HAL"
109+ - If enabled, there will be no protection on the drivers from concurently accessing them from another thread/interrupt/core
110+ - "Autoconnect WiFi on boot"
111+ - If enabled, WiFi will start with the last known configuration
112+ - Else it will wait for WiFi.begin
113+ - ``` make flash monitor ``` will build, upload and open serial monitor to your board
114+
59115![ Pin Functions] ( doc/esp32_pinmap.png )
0 commit comments