@@ -6,10 +6,13 @@ Not everything is working yet, you can not get it through package manager, but y
6
6
7
7
The framework can also be downloaded as component in an IDF project and be used like that.
8
8
9
- Things that "should" work:
9
+ Things that work:
10
+
10
11
- pinMode
11
12
- digitalRead/digitalWrite
12
13
- attachInterrupt/detachInterrupt
14
+ - analogRead/touchRead/touchAttachInterrupt
15
+ - ledcWrite/sdWrite/dacWrite
13
16
- Serial (global Serial is attached to pins 1 and 3 by default, there are another 2 serials that you can attach to any pin)
14
17
- SPI (global SPI is attached to VSPI pins by default and HSPI can be attached to any pins)
15
18
- 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
56
59
```
57
60
- Restart Arduino IDE
58
61
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
+
59
115
![ Pin Functions] ( doc/esp32_pinmap.png )
0 commit comments