Skip to content

Commit a07e1ae

Browse files
committed
Merge remote-tracking branch 'upstream/master'
Conflicts: boards.txt cores/esp32/Arduino.h cores/esp32/wiring_private.h cores/esp32/wiring_shift.c
2 parents d602169 + 67fd652 commit a07e1ae

File tree

182 files changed

+18801
-1121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+18801
-1121
lines changed

‎Kconfig‎

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
menu "Arduino Configuration"
2+
3+
choice MONITOR_BAUD
4+
prompt "Monitor baud rate"
5+
default MONITOR_BAUD_115200B
6+
help
7+
Baud rate to use while monitoring the ESP chip.
8+
9+
config MONITOR_BAUD_9600B
10+
bool "9600 bps"
11+
config MONITOR_BAUD_57600B
12+
bool "57600 bps"
13+
config MONITOR_BAUD_115200B
14+
bool "115200 bps"
15+
config MONITOR_BAUD_230400B
16+
bool "230400 bps"
17+
config MONITOR_BAUD_921600B
18+
bool "921600 bps"
19+
config MONITOR_BAUD_2MB
20+
bool "2 Mbps"
21+
config MONITOR_BAUD_OTHER
22+
bool "Custom baud rate"
23+
24+
endchoice
25+
26+
config MONITOR_BAUD_OTHER_VAL
27+
int "Custom baud rate value" if MONITOR_BAUD_OTHER
28+
default 115200
29+
30+
config MONITOR_BAUD
31+
int
32+
default 9600 if MONITOR_BAUD_9600B
33+
default 57600 if MONITOR_BAUD_57600B
34+
default 115200 if MONITOR_BAUD_115200B
35+
default 230400 if MONITOR_BAUD_230400B
36+
default 921600 if MONITOR_BAUD_921600B
37+
default 2000000 if MONITOR_BAUD_2MB
38+
default MONITOR_BAUD_OTHER_VAL if MONITOR_BAUD_OTHER
39+
40+
config AUTOSTART_ARDUINO
41+
bool "Autostart Arduino setup and loop on boot"
42+
default "n"
43+
help
44+
Enabling this option will implement app_main and start Arduino.
45+
All you need to implement in your main.cpp is setup() and loop()
46+
and include Arduino.h
47+
If disabled, you can call initArduino() to run any preparations
48+
required by the framework
49+
50+
config DISABLE_HAL_LOCKS
51+
bool "Disable mutex locks for HAL"
52+
default "n"
53+
help
54+
Enabling this option will run all hardware abstraction without locks.
55+
While communication with external hardware will be faster, you need to
56+
make sure that there is no option to use the same bus from another thread
57+
or interrupt at the same time. Option is best used with Arduino enabled
58+
and code implemented only in setup/loop and Arduino callbacks
59+
60+
menu "Debug Log Configuration"
61+
choice ARDUHAL_LOG_DEFAULT_LEVEL
62+
bool "Default log level"
63+
default ARDUHAL_LOG_DEFAULT_LEVEL_ERROR
64+
help
65+
Specify how much output to see in logs by default.
66+
67+
config ARDUHAL_LOG_DEFAULT_LEVEL_NONE
68+
bool "No output"
69+
config ARDUHAL_LOG_DEFAULT_LEVEL_ERROR
70+
bool "Error"
71+
config ARDUHAL_LOG_DEFAULT_LEVEL_WARN
72+
bool "Warning"
73+
config ARDUHAL_LOG_DEFAULT_LEVEL_INFO
74+
bool "Info"
75+
config ARDUHAL_LOG_DEFAULT_LEVEL_DEBUG
76+
bool "Debug"
77+
config ARDUHAL_LOG_DEFAULT_LEVEL_VERBOSE
78+
bool "Verbose"
79+
endchoice
80+
81+
config ARDUHAL_LOG_DEFAULT_LEVEL
82+
int
83+
default 0 if ARDUHAL_LOG_DEFAULT_LEVEL_NONE
84+
default 1 if ARDUHAL_LOG_DEFAULT_LEVEL_ERROR
85+
default 2 if ARDUHAL_LOG_DEFAULT_LEVEL_WARN
86+
default 3 if ARDUHAL_LOG_DEFAULT_LEVEL_INFO
87+
default 4 if ARDUHAL_LOG_DEFAULT_LEVEL_DEBUG
88+
default 5 if ARDUHAL_LOG_DEFAULT_LEVEL_VERBOSE
89+
90+
config ARDUHAL_LOG_COLORS
91+
bool "Use ANSI terminal colors in log output"
92+
default "n"
93+
help
94+
Enable ANSI terminal color codes in bootloader output.
95+
In order to view these, your terminal program must support ANSI color codes.
96+
97+
endmenu
98+
99+
config AUTOCONNECT_WIFI
100+
bool "Autoconnect WiFi on boot"
101+
default "n"
102+
depends on AUTOSTART_ARDUINO
103+
help
104+
If enabled, WiFi will connect to the last used SSID (if station was enabled),
105+
else connection will be started only after calling WiFi.begin(ssid, password)
106+
107+
endmenu

‎Makefile.projbuild‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#build with "make flash monitor" to upload and open serial monitor
2+
monitor:
3+
$(Q) miniterm.py --rts 0 --dtr 0 --raw $(ESPPORT) $(CONFIG_MONITOR_BAUD)

‎boards.txt‎

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ espea32.menu.UploadSpeed.460800.upload.speed=460800
201201
espea32.menu.UploadSpeed.512000.windows=512000
202202
espea32.menu.UploadSpeed.512000.upload.speed=512000
203203

204-
205204
##############################################################
206205
featheresp32.name=Feather ESP32
207206

@@ -240,4 +239,84 @@ featheresp32.menu.UploadSpeed.460800.linux=460800
240239
featheresp32.menu.UploadSpeed.460800.macosx=460800
241240
featheresp32.menu.UploadSpeed.460800.upload.speed=460800
242241
featheresp32.menu.UploadSpeed.512000.windows=512000
243-
featheresp32.menu.UploadSpeed.512000.upload.speed=512000
242+
featheresp32.menu.UploadSpeed.512000.upload.speed=512000
243+
244+
##############################################################
245+
quantum.name=Noduino Quantum
246+
247+
quantum.upload.tool=esptool
248+
quantum.upload.maximum_size=1044464
249+
quantum.upload.maximum_data_size=294912
250+
quantum.upload.wait_for_upload_port=true
251+
252+
quantum.serial.disableDTR=true
253+
quantum.serial.disableRTS=true
254+
255+
quantum.build.mcu=esp32
256+
quantum.build.core=esp32
257+
quantum.build.variant=quantum
258+
quantum.build.board=QUANTUM
259+
260+
quantum.build.f_cpu=160000000L
261+
quantum.build.flash_mode=qio
262+
quantum.build.flash_size=16MB
263+
264+
quantum.menu.FlashFreq.80=80MHz
265+
quantum.menu.FlashFreq.80.build.flash_freq=80m
266+
quantum.menu.FlashFreq.40=40MHz
267+
quantum.menu.FlashFreq.40.build.flash_freq=40m
268+
269+
quantum.menu.UploadSpeed.921600=921600
270+
quantum.menu.UploadSpeed.921600.upload.speed=921600
271+
quantum.menu.UploadSpeed.115200=115200
272+
quantum.menu.UploadSpeed.115200.upload.speed=115200
273+
quantum.menu.UploadSpeed.256000.windows=256000
274+
quantum.menu.UploadSpeed.256000.upload.speed=256000
275+
quantum.menu.UploadSpeed.230400.windows.upload.speed=256000
276+
quantum.menu.UploadSpeed.230400=230400
277+
quantum.menu.UploadSpeed.230400.upload.speed=230400
278+
quantum.menu.UploadSpeed.460800.linux=460800
279+
quantum.menu.UploadSpeed.460800.macosx=460800
280+
quantum.menu.UploadSpeed.460800.upload.speed=460800
281+
quantum.menu.UploadSpeed.512000.windows=512000
282+
quantum.menu.UploadSpeed.512000.upload.speed=512000
283+
284+
##############################################################
285+
node32s.name=Node32s
286+
287+
node32s.upload.tool=esptool
288+
node32s.upload.maximum_size=1044464
289+
node32s.upload.maximum_data_size=294912
290+
node32s.upload.wait_for_upload_port=true
291+
292+
node32s.serial.disableDTR=true
293+
node32s.serial.disableRTS=true
294+
295+
node32s.build.mcu=esp32
296+
node32s.build.core=esp32
297+
node32s.build.variant=node32s
298+
node32s.build.board=Node32s
299+
300+
node32s.build.f_cpu=160000000L
301+
node32s.build.flash_mode=dio
302+
node32s.build.flash_size=4MB
303+
304+
node32s.menu.FlashFreq.80=80MHz
305+
node32s.menu.FlashFreq.80.build.flash_freq=80m
306+
node32s.menu.FlashFreq.40=40MHz
307+
node32s.menu.FlashFreq.40.build.flash_freq=40m
308+
309+
node32s.menu.UploadSpeed.921600=921600
310+
node32s.menu.UploadSpeed.921600.upload.speed=921600
311+
node32s.menu.UploadSpeed.115200=115200
312+
node32s.menu.UploadSpeed.115200.upload.speed=115200
313+
node32s.menu.UploadSpeed.256000.windows=256000
314+
node32s.menu.UploadSpeed.256000.upload.speed=256000
315+
node32s.menu.UploadSpeed.230400.windows.upload.speed=256000
316+
node32s.menu.UploadSpeed.230400=230400
317+
node32s.menu.UploadSpeed.230400.upload.speed=230400
318+
node32s.menu.UploadSpeed.460800.linux=460800
319+
node32s.menu.UploadSpeed.460800.macosx=460800
320+
node32s.menu.UploadSpeed.460800.upload.speed=460800
321+
node32s.menu.UploadSpeed.512000.windows=512000
322+
node32s.menu.UploadSpeed.512000.upload.speed=512000

‎component.mk‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
COMPONENT_ADD_INCLUDEDIRS := cores/esp32 variants/esp32 libraries/WiFi/src libraries/SPI/src libraries/Wire/src
22
COMPONENT_PRIV_INCLUDEDIRS := cores/esp32/libb64
33
COMPONENT_SRCDIRS := cores/esp32/libb64 cores/esp32 variants/esp32 libraries/WiFi/src libraries/SPI/src libraries/Wire/src
4-
include$(IDF_PATH)/make/component_common.mk
54
CXXFLAGS += -fno-rtti

‎cores/esp32/Arduino.h‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,8 @@ typedef bool boolean;
121121
typedefuint8_t byte;
122122
typedefunsignedint word;
123123

124-
// Shifty prototypes
125-
voidshiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
126124
uint8_tshiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
125+
voidshiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
127126

128127
#ifdef __cplusplus
129128
}
@@ -147,8 +146,14 @@ uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
147146
#include"HardwareSerial.h"
148147
#include"Esp.h"
149148

149+
// WMath prototypes
150+
longrandom(long);
150151
#endif/* __cplusplus */
151152

153+
longrandom(long, long);
154+
voidrandomSeed(unsignedlong);
155+
longmap(long, long, long, long, long);
156+
152157
#ifndef _GLIBCXX_VECTOR
153158
// arduino is not compatible with std::vector
154159
#definemin(a,b) ((a)<(b)?(a):(b))
@@ -158,12 +163,6 @@ uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
158163
#define_min(a,b) ((a)<(b)?(a):(b))
159164
#define_max(a,b) ((a)>(b)?(a):(b))
160165

161-
// WMath prototypes
162-
longrandom(long, long);
163-
//long random(long);
164-
voidrandomSeed(unsignedlong);
165-
longmap(long, long, long, long, long);
166-
167166
#include"pins_arduino.h"
168167

169168
#endif /* _ESP32_CORE_ARDUINO_H_ */

‎cores/esp32/HardwareSerial.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ class HardwareSerial: public Stream
4646
size_twrite(uint8_t);
4747
size_twrite(constuint8_t *buffer, size_t size);
4848

49+
inlinesize_twrite(constchar * s)
50+
{
51+
returnwrite((uint8_t*) s, strlen(s));
52+
}
4953
inlinesize_twrite(unsignedlong n)
5054
{
5155
returnwrite((uint8_t) n);

‎cores/esp32/esp32-hal-i2c.c‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030

3131
structi2c_struct_t{
3232
i2c_dev_t*dev;
33+
#if !CONFIG_DISABLE_HAL_LOCKS
3334
xSemaphoreHandlelock;
35+
#endif
3436
uint8_tnum;
3537
};
3638

@@ -42,13 +44,23 @@ enum{
4244
I2C_CMD_END
4345
};
4446

47+
#ifCONFIG_DISABLE_HAL_LOCKS
48+
#defineI2C_MUTEX_LOCK()
49+
#defineI2C_MUTEX_UNLOCK()
50+
51+
statici2c_t_i2c_bus_array[2] ={
52+
{(volatilei2c_dev_t*)(DR_REG_I2C_EXT_BASE), 0},
53+
{(volatilei2c_dev_t*)(DR_REG_I2C1_EXT_BASE), 1}
54+
};
55+
#else
4556
#defineI2C_MUTEX_LOCK() do{} while (xSemaphoreTake(i2c->lock, portMAX_DELAY) != pdPASS)
4657
#defineI2C_MUTEX_UNLOCK() xSemaphoreGive(i2c->lock)
4758

4859
statici2c_t_i2c_bus_array[2] ={
4960
{(volatilei2c_dev_t*)(DR_REG_I2C_EXT_BASE), NULL, 0},
5061
{(volatilei2c_dev_t*)(DR_REG_I2C1_EXT_BASE), NULL, 1}
5162
};
63+
#endif
5264

5365
i2c_err_ti2cAttachSCL(i2c_t*i2c, int8_tscl)
5466
{
@@ -112,6 +124,13 @@ void i2cSetCmd(i2c_t * i2c, uint8_t index, uint8_t op_code, uint8_t byte_num, bo
112124
i2c->dev->command[index].op_code=op_code;
113125
}
114126

127+
voidi2cResetCmd(i2c_t*i2c){
128+
inti;
129+
for(i=0;i<16;i++){
130+
i2c->dev->command[i].val=0;
131+
}
132+
}
133+
115134
voidi2cResetFiFo(i2c_t*i2c)
116135
{
117136
i2c->dev->fifo_conf.tx_fifo_rst=1;
@@ -138,6 +157,7 @@ i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * dat
138157
uint8_tdataSend=willSend;
139158

140159
i2cResetFiFo(i2c);
160+
i2cResetCmd(i2c);
141161

142162
//CMD START
143163
i2cSetCmd(i2c, 0, I2C_CMD_RSTART, 0, false, false, false);
@@ -222,6 +242,7 @@ i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * data
222242
I2C_MUTEX_LOCK();
223243

224244
i2cResetFiFo(i2c);
245+
i2cResetCmd(i2c);
225246

226247
//CMD START
227248
i2cSetCmd(i2c, 0, I2C_CMD_RSTART, 0, false, false, false);
@@ -344,12 +365,14 @@ i2c_t * i2cInit(uint8_t i2c_num, uint16_t slave_addr, bool addr_10bit_en)
344365

345366
i2c_t*i2c=&_i2c_bus_array[i2c_num];
346367

368+
#if !CONFIG_DISABLE_HAL_LOCKS
347369
if(i2c->lock==NULL){
348370
i2c->lock=xSemaphoreCreateMutex();
349371
if(i2c->lock==NULL){
350372
returnNULL;
351373
}
352374
}
375+
#endif
353376

354377
if(i2c_num==0){
355378
SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG,DPORT_I2C_EXT0_CLK_EN);

‎cores/esp32/esp32-hal-ledc.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@
2222
#include"soc/ledc_reg.h"
2323
#include"soc/ledc_struct.h"
2424

25-
xSemaphoreHandle_ledc_sys_lock;
26-
27-
25+
#ifCONFIG_DISABLE_HAL_LOCKS
26+
#defineLEDC_MUTEX_LOCK()
27+
#defineLEDC_MUTEX_UNLOCK()
28+
#else
2829
#defineLEDC_MUTEX_LOCK() do{} while (xSemaphoreTake(_ledc_sys_lock, portMAX_DELAY) != pdPASS)
2930
#defineLEDC_MUTEX_UNLOCK() xSemaphoreGive(_ledc_sys_lock)
31+
xSemaphoreHandle_ledc_sys_lock;
32+
#endif
3033

3134
/*
3235
* LEDC Chan to Group/Channel/Timer Mapping
@@ -59,7 +62,9 @@ void ledcSetupTimer(uint8_t chan, uint32_t div_num, uint8_t bit_num, bool apb_cl
5962
SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_LEDC_CLK_EN);
6063
CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_LEDC_RST);
6164
ledc_dev->conf.apb_clk_sel=1;//LS use apb clock
65+
#if !CONFIG_DISABLE_HAL_LOCKS
6266
_ledc_sys_lock=xSemaphoreCreateMutex();
67+
#endif
6368
}
6469
LEDC_MUTEX_LOCK();
6570
ledc_dev->timer_group[group].timer[timer].conf.div_num=div_num;//18 bit (10.8) This register is used to configure parameter for divider in timer the least significant eight bits represent the decimal part.

0 commit comments

Comments
(0)