Skip to content

Commit 69917cb

Browse files
authored
Merge branch 'espressif:master' into master
2 parents 3fc9d5f + 6d9ebea commit 69917cb

File tree

49 files changed

+2115
-950
lines changed

Some content is hidden

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

49 files changed

+2115
-950
lines changed

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ version: 2
99
build:
1010
os: ubuntu-22.04
1111
tools:
12-
python: "3.10"
12+
python: "3.12"
1313

1414
# Build documentation in the docs/ directory with Sphinx
1515
sphinx:

.readthedocs.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ set(includedirs
212212

213213
set(srcs ${CORE_SRCS} ${LIBRARY_SRCS} ${BLE_SRCS})
214214
set(priv_includes cores/esp32/libb64)
215-
set(requires spi_flash mbedtls wifi_provisioning wpa_supplicant esp_adc esp_eth http_parser)
215+
set(requires spi_flash esp_partition mbedtls wifi_provisioning wpa_supplicant esp_adc esp_eth http_parser)
216216
set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hid)
217217

218218
idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires})

boards.txt

Lines changed: 732 additions & 311 deletions
Large diffs are not rendered by default.

cores/esp32/HWCDC.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -436,12 +436,9 @@ void HWCDC::setDebugOutput(bool en)
436436
}
437437
}
438438

439-
#if ARDUINO_USB_MODE
440-
#if ARDUINO_USB_CDC_ON_BOOT//Serial used for USB CDC
441-
HWCDC Serial;
442-
#else
443-
HWCDC USBSerial;
444-
#endif
439+
#if ARDUINO_USB_MODE // Hardware JTAG CDC selected
440+
// USBSerial is always available to be used
441+
HWCDC HWCDCSerial;
445442
#endif
446443

447444
#endif /* SOC_USB_SERIAL_JTAG_SUPPORTED */

cores/esp32/HWCDC.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,12 @@ class HWCDC: public Stream
102102
uint32_t baudRate(){return 115200;}
103103

104104
};
105-
106-
#if ARDUINO_USB_MODE
107-
#if ARDUINO_USB_CDC_ON_BOOT//Serial used for USB CDC
108-
extern HWCDC Serial;
109-
#else
110-
extern HWCDC USBSerial;
105+
#if ARDUINO_USB_MODE // Hardware JTAG CDC selected
106+
#ifndef HWCDC_SERIAL_IS_DEFINED
107+
#define HWCDC_SERIAL_IS_DEFINED 1
111108
#endif
109+
// HWCDCSerial is always available to be used
110+
extern HWCDC HWCDCSerial;
112111
#endif
113112

114-
#endif /* CONFIG_IDF_TARGET_ESP32C3 */
113+
#endif /* SOC_USB_SERIAL_JTAG_SUPPORTED */

cores/esp32/HardwareSerial.cpp

Lines changed: 25 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -22,116 +22,50 @@
2222
#define ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE -1
2323
#endif
2424

25-
#ifndef SOC_RX0
26-
#if CONFIG_IDF_TARGET_ESP32
27-
#define SOC_RX0 3
28-
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
29-
#define SOC_RX0 44
30-
#elif CONFIG_IDF_TARGET_ESP32C3
31-
#define SOC_RX0 20
32-
#elif CONFIG_IDF_TARGET_ESP32C6
33-
#define SOC_RX0 17
34-
#elif CONFIG_IDF_TARGET_ESP32H2
35-
#define SOC_RX0 23
36-
#endif
37-
#endif
38-
39-
#ifndef SOC_TX0
40-
#if CONFIG_IDF_TARGET_ESP32
41-
#define SOC_TX0 1
42-
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
43-
#define SOC_TX0 43
44-
#elif CONFIG_IDF_TARGET_ESP32C3
45-
#define SOC_TX0 21
46-
#elif CONFIG_IDF_TARGET_ESP32C6
47-
#define SOC_TX0 16
48-
#elif CONFIG_IDF_TARGET_ESP32H2
49-
#define SOC_TX0 24
50-
#endif
51-
#endif
52-
5325
void serialEvent(void) __attribute__((weak));
5426
void serialEvent(void) {}
5527

5628
#if SOC_UART_NUM > 1
57-
58-
#ifndef RX1
59-
#if CONFIG_IDF_TARGET_ESP32
60-
#define RX1 9
61-
#elif CONFIG_IDF_TARGET_ESP32S2
62-
#define RX1 18
63-
#elif CONFIG_IDF_TARGET_ESP32C3
64-
#define RX1 18
65-
#elif CONFIG_IDF_TARGET_ESP32S3
66-
#define RX1 15
67-
#elif CONFIG_IDF_TARGET_ESP32C6
68-
#define RX1 4
69-
#elif CONFIG_IDF_TARGET_ESP32H2
70-
#define RX1 0
71-
#endif
72-
#endif
73-
74-
#ifndef TX1
75-
#if CONFIG_IDF_TARGET_ESP32
76-
#define TX1 10
77-
#elif CONFIG_IDF_TARGET_ESP32S2
78-
#define TX1 17
79-
#elif CONFIG_IDF_TARGET_ESP32C3
80-
#define TX1 19
81-
#elif CONFIG_IDF_TARGET_ESP32S3
82-
#define TX1 16
83-
#elif CONFIG_IDF_TARGET_ESP32C6
84-
#define TX1 5
85-
#elif CONFIG_IDF_TARGET_ESP32H2
86-
#define TX1 1
87-
#endif
88-
#endif
89-
9029
void serialEvent1(void) __attribute__((weak));
9130
void serialEvent1(void) {}
9231
#endif /* SOC_UART_NUM > 1 */
9332

9433
#if SOC_UART_NUM > 2
95-
#ifndef RX2
96-
#if CONFIG_IDF_TARGET_ESP32
97-
#define RX2 16
98-
#elif CONFIG_IDF_TARGET_ESP32S3
99-
#define RX2 19
100-
#endif
101-
#endif
102-
103-
#ifndef TX2
104-
#if CONFIG_IDF_TARGET_ESP32
105-
#define TX2 17
106-
#elif CONFIG_IDF_TARGET_ESP32S3
107-
#define TX2 20
108-
#endif
109-
#endif
110-
11134
void serialEvent2(void) __attribute__((weak));
11235
void serialEvent2(void) {}
11336
#endif /* SOC_UART_NUM > 2 */
11437

11538
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
116-
#if ARDUINO_USB_CDC_ON_BOOT //Serial used for USB CDC
39+
// There is always Seria0 for UART0
11740
HardwareSerial Serial0(0);
118-
#else
119-
HardwareSerial Serial(0);
120-
#endif
12141
#if SOC_UART_NUM > 1
12242
HardwareSerial Serial1(1);
12343
#endif
12444
#if SOC_UART_NUM > 2
12545
HardwareSerial Serial2(2);
12646
#endif
12747

48+
#if HWCDC_SERIAL_IS_DEFINED == 1 // Hardware JTAG CDC Event
49+
extern void HWCDCSerialEvent (void)__attribute__((weak));
50+
void HWCDCSerialEvent(void) {}
51+
#endif
52+
53+
#if USB_SERIAL_IS_DEFINED == 1 // Native USB CDC Event
54+
// Used by Hardware Serial for USB CDC events
55+
extern void USBSerialEvent (void)__attribute__((weak));
56+
void USBSerialEvent(void) {}
57+
#endif
58+
12859
void serialEventRun(void)
12960
{
130-
#if ARDUINO_USB_CDC_ON_BOOT //Serial used for USB CDC
61+
#if HWCDC_SERIAL_IS_DEFINED == 1 // Hardware JTAG CDC Event
62+
if(HWCDCSerial.available()) HWCDCSerialEvent();
63+
#endif
64+
#if USB_SERIAL_IS_DEFINED == 1 // Native USB CDC Event
65+
if(USBSerial.available()) USBSerialEvent();
66+
#endif
67+
// UART0 is default serialEvent()
13168
if(Serial0.available()) serialEvent();
132-
#else
133-
if(Serial.available()) serialEvent();
134-
#endif
13569
#if SOC_UART_NUM > 1
13670
if(Serial1.available()) serialEvent1();
13771
#endif
@@ -370,25 +304,25 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
370304
case UART_NUM_0:
371305
if (rxPin < 0 && txPin < 0) {
372306
// do not change RX0/TX0 if it has already been set before
373-
rxPin = _rxPin < 0 ? SOC_RX0 : _rxPin;
374-
txPin = _txPin < 0 ? SOC_TX0 : _txPin;
307+
rxPin = _rxPin < 0 ? (int8_t)SOC_RX0 : _rxPin;
308+
txPin = _txPin < 0 ? (int8_t)SOC_TX0 : _txPin;
375309
}
376310
break;
377311
#if SOC_UART_NUM > 1 // may save some flash bytes...
378312
case UART_NUM_1:
379313
if (rxPin < 0 && txPin < 0) {
380314
// do not change RX1/TX1 if it has already been set before
381-
rxPin = _rxPin < 0 ? RX1 : _rxPin;
382-
txPin = _txPin < 0 ? TX1 : _txPin;
315+
rxPin = _rxPin < 0 ? (int8_t)RX1 : _rxPin;
316+
txPin = _txPin < 0 ? (int8_t)TX1 : _txPin;
383317
}
384318
break;
385319
#endif
386320
#if SOC_UART_NUM > 2 // may save some flash bytes...
387321
case UART_NUM_2:
388322
if (rxPin < 0 && txPin < 0) {
389323
// do not change RX2/TX2 if it has already been set before
390-
rxPin = _rxPin < 0 ? RX2 : _rxPin;
391-
txPin = _txPin < 0 ? TX2 : _txPin;
324+
rxPin = _rxPin < 0 ? (int8_t)RX2 : _rxPin;
325+
txPin = _txPin < 0 ? (int8_t)TX2 : _txPin;
392326
}
393327
break;
394328
#endif

0 commit comments

Comments
 (0)