Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-esp32
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-esp32
Commits
e1673e4c
Commit
e1673e4c
authored
Aug 19, 2024
by
me-no-dev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(build): IDF release/v5.3 466a392a and initial changes
parent
def319ad
Changes
27
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
368 additions
and
542 deletions
+368
-542
.github/scripts/on-release.sh
.github/scripts/on-release.sh
+3
-17
.github/workflows/push.yml
.github/workflows/push.yml
+22
-21
.gitignore
.gitignore
+1
-0
CMakeLists.txt
CMakeLists.txt
+3
-3
cores/esp32/Client.h
cores/esp32/Client.h
+2
-0
cores/esp32/HWCDC.cpp
cores/esp32/HWCDC.cpp
+8
-8
cores/esp32/HardwareSerial.cpp
cores/esp32/HardwareSerial.cpp
+12
-12
cores/esp32/HardwareSerial.h
cores/esp32/HardwareSerial.h
+6
-6
cores/esp32/esp32-hal-i2c-slave.c
cores/esp32/esp32-hal-i2c-slave.c
+15
-15
cores/esp32/esp32-hal-touch.c
cores/esp32/esp32-hal-touch.c
+18
-18
cores/esp32/esp32-hal-touch.h
cores/esp32/esp32-hal-touch.h
+5
-5
cores/esp32/esp32-hal-uart.c
cores/esp32/esp32-hal-uart.c
+23
-23
idf_component.yml
idf_component.yml
+1
-1
libraries/BluetoothSerial/examples/SerialToSerialBT_Legacy/SerialToSerialBT_Legacy.ino
...mples/SerialToSerialBT_Legacy/SerialToSerialBT_Legacy.ino
+0
-7
libraries/BluetoothSerial/examples/SerialToSerialBT_SSP/SerialToSerialBT_SSP.ino
...al/examples/SerialToSerialBT_SSP/SerialToSerialBT_SSP.ino
+0
-5
libraries/BluetoothSerial/src/BluetoothSerial.cpp
libraries/BluetoothSerial/src/BluetoothSerial.cpp
+0
-15
libraries/BluetoothSerial/src/BluetoothSerial.h
libraries/BluetoothSerial/src/BluetoothSerial.h
+0
-5
libraries/ESP32/examples/Serial/Serial_STD_Func_OnReceive/Serial_STD_Func_OnReceive.ino
...l/Serial_STD_Func_OnReceive/Serial_STD_Func_OnReceive.ino
+5
-5
libraries/ESP_I2S/src/ESP_I2S.cpp
libraries/ESP_I2S/src/ESP_I2S.cpp
+1
-1
libraries/ESP_I2S/src/ESP_I2S.h
libraries/ESP_I2S/src/ESP_I2S.h
+1
-1
libraries/Ethernet/src/ETH.cpp
libraries/Ethernet/src/ETH.cpp
+5
-0
libraries/Insights/examples/DiagnosticsSmokeTest/DiagnosticsSmokeTest.ino
...ts/examples/DiagnosticsSmokeTest/DiagnosticsSmokeTest.ino
+2
-1
libraries/Network/src/NetworkClient.h
libraries/Network/src/NetworkClient.h
+0
-2
libraries/PPP/src/PPP.cpp
libraries/PPP/src/PPP.cpp
+1
-1
package/package_esp32_index.template.json
package/package_esp32_index.template.json
+202
-336
platform.txt
platform.txt
+2
-4
tests/validation/uart/uart.ino
tests/validation/uart/uart.ino
+30
-30
No files found.
.github/scripts/on-release.sh
View file @
e1673e4c
...
...
@@ -219,12 +219,8 @@ find "$PKG_DIR" -name '*.git*' -type f -delete
##
RVTC_NAME
=
"riscv32-esp-elf-gcc"
RVTC_NEW_NAME
=
"esp-rv32"
X32TC_NAME
=
"xtensa-esp
32
-elf-gcc"
X32TC_NAME
=
"xtensa-esp-elf-gcc"
X32TC_NEW_NAME
=
"esp-x32"
XS2TC_NAME
=
"xtensa-esp32s2-elf-gcc"
XS2TC_NEW_NAME
=
"esp-xs2"
XS3TC_NAME
=
"xtensa-esp32s3-elf-gcc"
XS3TC_NEW_NAME
=
"esp-xs3"
# Replace tools locations in platform.txt
echo
"Generating platform.txt..."
...
...
@@ -233,9 +229,7 @@ sed "s/version=.*/version=$RELEASE_TAG/g" | \
sed
's/tools\.esp32-arduino-libs\.path\.windows=.*//g'
|
\
sed
's/{runtime\.platform\.path}.tools.esp32-arduino-libs/\{runtime.tools.esp32-arduino-libs.path\}/g'
|
\
sed
's/{runtime\.platform\.path}.tools.xtensa-esp-elf-gdb/\{runtime.tools.xtensa-esp-elf-gdb.path\}/g'
|
\
sed
"s/{runtime
\.
platform
\.
path}.tools.xtensa-esp32-elf/
\\
{runtime.tools.
$X32TC_NEW_NAME
.path
\\
}/g"
|
\
sed
"s/{runtime
\.
platform
\.
path}.tools.xtensa-esp32s2-elf/
\\
{runtime.tools.
$XS2TC_NEW_NAME
.path
\\
}/g"
|
\
sed
"s/{runtime
\.
platform
\.
path}.tools.xtensa-esp32s3-elf/
\\
{runtime.tools.
$XS3TC_NEW_NAME
.path
\\
}/g"
|
\
sed
"s/{runtime
\.
platform
\.
path}.tools.xtensa-esp-elf/
\\
{runtime.tools.
$X32TC_NEW_NAME
.path
\\
}/g"
|
\
sed
's/{runtime\.platform\.path}.tools.riscv32-esp-elf-gdb/\{runtime.tools.riscv32-esp-elf-gdb.path\}/g'
|
\
sed
"s/{runtime
\.
platform
\.
path}.tools.riscv32-esp-elf/
\\
{runtime.tools.
$RVTC_NEW_NAME
.path
\\
}/g"
|
\
sed
's/{runtime\.platform\.path}.tools.esptool/\{runtime.tools.esptool_py.path\}/g'
|
\
...
...
@@ -355,15 +349,7 @@ rvtc_jq_arg="\
(.packages[0].platforms[0].toolsDependencies[] | select(.name==
\"
$X32TC_NAME
\"
)).version =
\"
$RVTC_VERSION
\"
|
\
(.packages[0].platforms[0].toolsDependencies[] | select(.name==
\"
$X32TC_NAME
\"
)).name =
\"
$X32TC_NEW_NAME
\"
|
\
(.packages[0].tools[] | select(.name==
\"
$X32TC_NAME
\"
)).version =
\"
$RVTC_VERSION
\"
|
\
(.packages[0].tools[] | select(.name==
\"
$X32TC_NAME
\"
)).name =
\"
$X32TC_NEW_NAME
\"
|
\
(.packages[0].platforms[0].toolsDependencies[] | select(.name==
\"
$XS2TC_NAME
\"
)).version =
\"
$RVTC_VERSION
\"
|
\
(.packages[0].platforms[0].toolsDependencies[] | select(.name==
\"
$XS2TC_NAME
\"
)).name =
\"
$XS2TC_NEW_NAME
\"
|
\
(.packages[0].tools[] | select(.name==
\"
$XS2TC_NAME
\"
)).version =
\"
$RVTC_VERSION
\"
|
\
(.packages[0].tools[] | select(.name==
\"
$XS2TC_NAME
\"
)).name =
\"
$XS2TC_NEW_NAME
\"
|
\
(.packages[0].platforms[0].toolsDependencies[] | select(.name==
\"
$XS3TC_NAME
\"
)).version =
\"
$RVTC_VERSION
\"
|
\
(.packages[0].platforms[0].toolsDependencies[] | select(.name==
\"
$XS3TC_NAME
\"
)).name =
\"
$XS3TC_NEW_NAME
\"
|
\
(.packages[0].tools[] | select(.name==
\"
$XS3TC_NAME
\"
)).version =
\"
$RVTC_VERSION
\"
|
\
(.packages[0].tools[] | select(.name==
\"
$XS3TC_NAME
\"
)).name =
\"
$XS3TC_NEW_NAME
\"
"
(.packages[0].tools[] | select(.name==
\"
$X32TC_NAME
\"
)).name =
\"
$X32TC_NEW_NAME
\"
"
cat
"
$PACKAGE_JSON_TEMPLATE
"
| jq
"
$rvtc_jq_arg
"
>
"
$OUTPUT_DIR
/package-
$LIBS_PROJ_NAME
-rvfix.json"
PACKAGE_JSON_TEMPLATE
=
"
$OUTPUT_DIR
/package-
$LIBS_PROJ_NAME
-rvfix.json"
...
...
.github/workflows/push.yml
View file @
e1673e4c
...
...
@@ -194,28 +194,29 @@ jobs:
-
name
:
Build Sketches
run
:
bash ./.github/scripts/on-push.sh
# PlatformIO on Windows, Ubuntu and Mac
build-platformio
:
name
:
PlatformIO on ${{ matrix.os }}
needs
:
gen-chunks
if
:
|
needs.gen-chunks.outputs.build_all == 'true' ||
needs.gen-chunks.outputs.build_static_sketches == 'true' ||
needs.gen-chunks.outputs.build_platformio == 'true'
runs-on
:
${{ matrix.os }}
strategy
:
fail-fast
:
false
matrix
:
os
:
[
ubuntu-latest
,
windows-latest
,
macOS-latest
]
#
#
PlatformIO on Windows, Ubuntu and Mac
#
build-platformio:
#
name: PlatformIO on ${{ matrix.os }}
#
needs: gen-chunks
#
if: |
#
needs.gen-chunks.outputs.build_all == 'true' ||
#
needs.gen-chunks.outputs.build_static_sketches == 'true' ||
#
needs.gen-chunks.outputs.build_platformio == 'true'
#
runs-on: ${{ matrix.os }}
#
strategy:
#
fail-fast: false
#
matrix:
#
os: [ubuntu-latest, windows-latest, macOS-latest]
steps
:
-
uses
:
actions/checkout@v4
-
uses
:
actions/setup-python@v5
with
:
python-version
:
'
3.x'
-
name
:
Build Sketches
run
:
bash ./.github/scripts/on-push.sh 1
1
#equal and non-zero to trigger PIO
#
steps:
#
- uses: actions/checkout@v4
#
- uses: actions/setup-python@v5
#
with:
#
python-version: '3.x'
#
- name: Build Sketches
#
run: bash ./.github/scripts/on-push.sh 1 1 #equal and non-zero to trigger PIO
# ESP-IDF component build
build-esp-idf-component
:
name
:
Build with ESP-IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
needs
:
gen-chunks
...
...
@@ -231,7 +232,7 @@ jobs:
# See https://hub.docker.com/r/espressif/idf/tags and
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html
# for details.
idf_ver
:
[
"
release-v5.
1
"
]
idf_ver
:
[
"
release-v5.
3
"
]
idf_target
:
[
"
esp32"
,
"
esp32s2"
,
"
esp32s3"
,
"
esp32c2"
,
"
esp32c3"
,
"
esp32c6"
,
"
esp32h2"
]
container
:
espressif/idf:${{ matrix.idf_ver }}
steps
:
...
...
.gitignore
View file @
e1673e4c
tools/esp32-arduino-libs
tools/xtensa-esp-elf
tools/xtensa-esp32-elf
tools/xtensa-esp32s2-elf
tools/xtensa-esp32s3-elf
...
...
CMakeLists.txt
View file @
e1673e4c
...
...
@@ -5,8 +5,8 @@
# export ARDUINO_SKIP_IDF_VERSION_CHECK=1
# idf.py build
set
(
min_supported_idf_version
"5.
1
.0"
)
set
(
max_supported_idf_version
"5.
1
.99"
)
set
(
min_supported_idf_version
"5.
3
.0"
)
set
(
max_supported_idf_version
"5.
3
.99"
)
set
(
idf_version
"
${
IDF_VERSION_MAJOR
}
.
${
IDF_VERSION_MINOR
}
.
${
IDF_VERSION_PATCH
}
"
)
if
(
"
${
idf_version
}
"
AND NOT
"$ENV{ARDUINO_SKIP_IDF_VERSION_CHECK}"
)
...
...
@@ -293,7 +293,7 @@ endforeach()
set
(
includedirs variants/
${
CONFIG_ARDUINO_VARIANT
}
/ cores/esp32/
${
ARDUINO_LIBRARIES_INCLUDEDIRS
}
)
set
(
srcs
${
CORE_SRCS
}
${
ARDUINO_LIBRARIES_SRCS
}
)
set
(
priv_includes cores/esp32/libb64
)
set
(
requires spi_flash esp_partition mbedtls wpa_supplicant esp_adc esp_eth http_parser espressif__network_provisioning
)
set
(
requires spi_flash esp_partition mbedtls wpa_supplicant esp_adc esp_eth http_parser esp
_ringbuf esp_driver_gptimer esp_driver_usb_serial_jtag driver esp
ressif__network_provisioning
)
set
(
priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hid usb esp_psram
${
ARDUINO_LIBRARIES_REQUIRES
}
)
if
(
NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_OpenThread
)
...
...
cores/esp32/Client.h
View file @
e1673e4c
...
...
@@ -26,7 +26,9 @@
class
Client
:
public
Stream
{
public:
virtual
int
connect
(
IPAddress
ip
,
uint16_t
port
)
=
0
;
virtual
int
connect
(
IPAddress
ip
,
uint16_t
port
,
int32_t
timeout
)
=
0
;
virtual
int
connect
(
const
char
*
host
,
uint16_t
port
)
=
0
;
virtual
int
connect
(
const
char
*
host
,
uint16_t
port
,
int32_t
timeout
)
=
0
;
virtual
size_t
write
(
uint8_t
)
=
0
;
virtual
size_t
write
(
const
uint8_t
*
buf
,
size_t
size
)
=
0
;
virtual
int
available
()
=
0
;
...
...
cores/esp32/HWCDC.cpp
View file @
e1673e4c
...
...
@@ -286,14 +286,14 @@ bool HWCDC::deinit(void *busptr) {
running
=
true
;
// Setting USB D+ D- pins
bool
retCode
=
true
;
retCode
&=
perimanClearPinBus
(
USB_DM_GPIO_NUM
);
retCode
&=
perimanClearPinBus
(
USB_DP_GPIO_NUM
);
retCode
&=
perimanClearPinBus
(
USB_
INT_PHY0_
DM_GPIO_NUM
);
retCode
&=
perimanClearPinBus
(
USB_
INT_PHY0_
DP_GPIO_NUM
);
if
(
retCode
)
{
// Force the host to re-enumerate (BUS_RESET)
pinMode
(
USB_DM_GPIO_NUM
,
OUTPUT_OPEN_DRAIN
);
pinMode
(
USB_DP_GPIO_NUM
,
OUTPUT_OPEN_DRAIN
);
digitalWrite
(
USB_DM_GPIO_NUM
,
LOW
);
digitalWrite
(
USB_DP_GPIO_NUM
,
LOW
);
pinMode
(
USB_
INT_PHY0_
DM_GPIO_NUM
,
OUTPUT_OPEN_DRAIN
);
pinMode
(
USB_
INT_PHY0_
DP_GPIO_NUM
,
OUTPUT_OPEN_DRAIN
);
digitalWrite
(
USB_
INT_PHY0_
DM_GPIO_NUM
,
LOW
);
digitalWrite
(
USB_
INT_PHY0_
DP_GPIO_NUM
,
LOW
);
}
// release the flag
running
=
false
;
...
...
@@ -323,11 +323,11 @@ void HWCDC::begin(unsigned long baud) {
// delay(10); // USB Host has to enumerate it again
// Peripheral Manager setting for USB D+ D- pins
uint8_t
pin
=
USB_DM_GPIO_NUM
;
uint8_t
pin
=
USB_
INT_PHY0_
DM_GPIO_NUM
;
if
(
!
perimanSetPinBus
(
pin
,
ESP32_BUS_TYPE_USB_DM
,
(
void
*
)
this
,
-
1
,
-
1
))
{
goto
err
;
}
pin
=
USB_DP_GPIO_NUM
;
pin
=
USB_
INT_PHY0_
DP_GPIO_NUM
;
if
(
!
perimanSetPinBus
(
pin
,
ESP32_BUS_TYPE_USB_DP
,
(
void
*
)
this
,
-
1
,
-
1
))
{
goto
err
;
}
...
...
cores/esp32/HardwareSerial.cpp
View file @
e1673e4c
...
...
@@ -26,23 +26,23 @@
void
serialEvent
(
void
)
__attribute__
((
weak
));
void
serialEvent
(
void
)
{}
#if SOC_UART_NUM > 1
#if SOC_UART_
HP_
NUM > 1
void
serialEvent1
(
void
)
__attribute__
((
weak
));
void
serialEvent1
(
void
)
{}
#endif
/* SOC_UART_NUM > 1 */
#endif
/* SOC_UART_
HP_
NUM > 1 */
#if SOC_UART_NUM > 2
#if SOC_UART_
HP_
NUM > 2
void
serialEvent2
(
void
)
__attribute__
((
weak
));
void
serialEvent2
(
void
)
{}
#endif
/* SOC_UART_NUM > 2 */
#endif
/* SOC_UART_
HP_
NUM > 2 */
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
// There is always Seria0 for UART0
HardwareSerial
Serial0
(
0
);
#if SOC_UART_NUM > 1
#if SOC_UART_
HP_
NUM > 1
HardwareSerial
Serial1
(
1
);
#endif
#if SOC_UART_NUM > 2
#if SOC_UART_
HP_
NUM > 2
HardwareSerial
Serial2
(
2
);
#endif
...
...
@@ -72,12 +72,12 @@ void serialEventRun(void) {
if
(
Serial0
.
available
())
{
serialEvent
();
}
#if SOC_UART_NUM > 1
#if SOC_UART_
HP_
NUM > 1
if
(
Serial1
.
available
())
{
serialEvent1
();
}
#endif
#if SOC_UART_NUM > 2
#if SOC_UART_
HP_
NUM > 2
if
(
Serial2
.
available
())
{
serialEvent2
();
}
...
...
@@ -279,8 +279,8 @@ void HardwareSerial::_uartEventTask(void *args) {
}
void
HardwareSerial
::
begin
(
unsigned
long
baud
,
uint32_t
config
,
int8_t
rxPin
,
int8_t
txPin
,
bool
invert
,
unsigned
long
timeout_ms
,
uint8_t
rxfifo_full_thrhd
)
{
if
(
_uart_nr
>=
SOC_UART_NUM
)
{
log_e
(
"Serial number is invalid, please use a number from 0 to %u"
,
SOC_UART_NUM
-
1
);
if
(
_uart_nr
>=
SOC_UART_
HP_
NUM
)
{
log_e
(
"Serial number is invalid, please use a number from 0 to %u"
,
SOC_UART_
HP_
NUM
-
1
);
return
;
}
...
...
@@ -305,7 +305,7 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
txPin
=
_txPin
<
0
?
(
int8_t
)
SOC_TX0
:
_txPin
;
}
break
;
#if SOC_UART_NUM > 1 // may save some flash bytes...
#if SOC_UART_
HP_
NUM > 1 // may save some flash bytes...
case
UART_NUM_1
:
if
(
rxPin
<
0
&&
txPin
<
0
)
{
// do not change RX1/TX1 if it has already been set before
...
...
@@ -314,7 +314,7 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
}
break
;
#endif
#if SOC_UART_NUM > 2 // may save some flash bytes...
#if SOC_UART_
HP_
NUM > 2 // may save some flash bytes...
case
UART_NUM_2
:
if
(
rxPin
<
0
&&
txPin
<
0
)
{
// do not change RX2/TX2 if it has already been set before
...
...
cores/esp32/HardwareSerial.h
View file @
e1673e4c
...
...
@@ -146,7 +146,7 @@ typedef enum {
// Default pins for UART1 are arbitrary, and defined here for convenience.
#if SOC_UART_NUM > 1
#if SOC_UART_
HP_
NUM > 1
#ifndef RX1
#if CONFIG_IDF_TARGET_ESP32
#define RX1 (gpio_num_t)26
...
...
@@ -182,11 +182,11 @@ typedef enum {
#define TX1 (gpio_num_t)1
#endif
#endif
#endif
/* SOC_UART_NUM > 1 */
#endif
/* SOC_UART_
HP_
NUM > 1 */
// Default pins for UART2 are arbitrary, and defined here for convenience.
#if SOC_UART_NUM > 2
#if SOC_UART_
HP_
NUM > 2
#ifndef RX2
#if CONFIG_IDF_TARGET_ESP32
#define RX2 (gpio_num_t)4
...
...
@@ -202,7 +202,7 @@ typedef enum {
#define TX2 (gpio_num_t)20
#endif
#endif
#endif
/* SOC_UART_NUM > 2 */
#endif
/* SOC_UART_
HP_
NUM > 2 */
typedef
std
::
function
<
void
(
void
)
>
OnReceiveCb
;
typedef
std
::
function
<
void
(
hardwareSerial_error_t
)
>
OnReceiveErrorCb
;
...
...
@@ -357,10 +357,10 @@ extern void serialEventRun(void) __attribute__((weak));
#endif // ARDUINO_USB_CDC_ON_BOOT
// There is always Seria0 for UART0
extern
HardwareSerial
Serial0
;
#if SOC_UART_NUM > 1
#if SOC_UART_
HP_
NUM > 1
extern
HardwareSerial
Serial1
;
#endif
#if SOC_UART_NUM > 2
#if SOC_UART_
HP_
NUM > 2
extern
HardwareSerial
Serial2
;
#endif
#endif //!defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
...
...
cores/esp32/esp32-hal-i2c-slave.c
View file @
e1673e4c
...
...
@@ -49,7 +49,7 @@
#define I2C_SLAVE_USE_RX_QUEUE 0 // 1: Queue, 0: RingBuffer
#if SOC_I2C_NUM > 1
#if SOC_
HP_
I2C_NUM > 1
#define I2C_SCL_IDX(p) ((p == 0) ? I2CEXT0_SCL_OUT_IDX : ((p == 1) ? I2CEXT1_SCL_OUT_IDX : 0))
#define I2C_SDA_IDX(p) ((p == 0) ? I2CEXT0_SDA_OUT_IDX : ((p == 1) ? I2CEXT1_SDA_OUT_IDX : 0))
#else
...
...
@@ -99,14 +99,14 @@ typedef union {
uint32_t
val
;
}
i2c_slave_queue_event_t
;
static
i2c_slave_struct_t
_i2c_bus_array
[
SOC_I2C_NUM
]
=
{
static
i2c_slave_struct_t
_i2c_bus_array
[
SOC_
HP_
I2C_NUM
]
=
{
{
&
I2C0
,
0
,
-
1
,
-
1
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
0
#if !CONFIG_DISABLE_HAL_LOCKS
,
NULL
#endif
},
#if SOC_I2C_NUM > 1
#if SOC_
HP_
I2C_NUM > 1
{
&
I2C1
,
1
,
-
1
,
-
1
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
0
#if !CONFIG_DISABLE_HAL_LOCKS
,
...
...
@@ -210,7 +210,7 @@ static bool i2cSlaveDetachBus(void *bus_i2c_num);
//=====================================================================================================================
esp_err_t
i2cSlaveAttachCallbacks
(
uint8_t
num
,
i2c_slave_request_cb_t
request_callback
,
i2c_slave_receive_cb_t
receive_callback
,
void
*
arg
)
{
if
(
num
>=
SOC_I2C_NUM
)
{
if
(
num
>=
SOC_
HP_
I2C_NUM
)
{
log_e
(
"Invalid port num: %u"
,
num
);
return
ESP_ERR_INVALID_ARG
;
}
...
...
@@ -224,7 +224,7 @@ esp_err_t i2cSlaveAttachCallbacks(uint8_t num, i2c_slave_request_cb_t request_ca
}
esp_err_t
i2cSlaveInit
(
uint8_t
num
,
int
sda
,
int
scl
,
uint16_t
slaveID
,
uint32_t
frequency
,
size_t
rx_len
,
size_t
tx_len
)
{
if
(
num
>=
SOC_I2C_NUM
)
{
if
(
num
>=
SOC_
HP_
I2C_NUM
)
{
log_e
(
"Invalid port num: %u"
,
num
);
return
ESP_ERR_INVALID_ARG
;
}
...
...
@@ -309,14 +309,14 @@ esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t
if
(
i2c
->
num
==
0
)
{
periph_ll_enable_clk_clear_rst
(
PERIPH_I2C0_MODULE
);
#if SOC_I2C_NUM > 1
#if SOC_
HP_
I2C_NUM > 1
}
else
{
periph_ll_enable_clk_clear_rst
(
PERIPH_I2C1_MODULE
);
#endif
}
i2c_ll_slave_init
(
i2c
->
dev
);
i2c_ll_set_fifo_mode
(
i2c
->
dev
,
true
);
i2c_ll_s
lave_s
et_fifo_mode
(
i2c
->
dev
,
true
);
i2c_ll_set_slave_addr
(
i2c
->
dev
,
slaveID
,
false
);
i2c_ll_set_tout
(
i2c
->
dev
,
I2C_LL_MAX_TIMEOUT
);
i2c_slave_set_frequency
(
i2c
,
frequency
);
...
...
@@ -337,13 +337,13 @@ esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t
i2c_ll_disable_intr_mask
(
i2c
->
dev
,
I2C_LL_INTR_MASK
);
i2c_ll_clear_intr_mask
(
i2c
->
dev
,
I2C_LL_INTR_MASK
);
i2c_ll_set_fifo_mode
(
i2c
->
dev
,
true
);
i2c_ll_s
lave_s
et_fifo_mode
(
i2c
->
dev
,
true
);
if
(
!
i2c
->
intr_handle
)
{
uint32_t
flags
=
ESP_INTR_FLAG_LOWMED
|
ESP_INTR_FLAG_SHARED
;
if
(
i2c
->
num
==
0
)
{
ret
=
esp_intr_alloc
(
ETS_I2C_EXT0_INTR_SOURCE
,
flags
,
&
i2c_slave_isr_handler
,
i2c
,
&
i2c
->
intr_handle
);
#if SOC_I2C_NUM > 1
#if SOC_
HP_
I2C_NUM > 1
}
else
{
ret
=
esp_intr_alloc
(
ETS_I2C_EXT1_INTR_SOURCE
,
flags
,
&
i2c_slave_isr_handler
,
i2c
,
&
i2c
->
intr_handle
);
#endif
...
...
@@ -375,7 +375,7 @@ fail:
}
esp_err_t
i2cSlaveDeinit
(
uint8_t
num
)
{
if
(
num
>=
SOC_I2C_NUM
)
{
if
(
num
>=
SOC_
HP_
I2C_NUM
)
{
log_e
(
"Invalid port num: %u"
,
num
);
return
ESP_ERR_INVALID_ARG
;
}
...
...
@@ -398,7 +398,7 @@ esp_err_t i2cSlaveDeinit(uint8_t num) {
}
size_t
i2cSlaveWrite
(
uint8_t
num
,
const
uint8_t
*
buf
,
uint32_t
len
,
uint32_t
timeout_ms
)
{
if
(
num
>=
SOC_I2C_NUM
)
{
if
(
num
>=
SOC_
HP_
I2C_NUM
)
{
log_e
(
"Invalid port num: %u"
,
num
);
return
0
;
}
...
...
@@ -515,16 +515,16 @@ static bool i2c_slave_set_frequency(i2c_slave_struct_t *i2c, uint32_t clk_speed)
i2c_hal_clk_config_t
clk_cal
;
#if SOC_I2C_SUPPORT_APB
i2c_ll_cal_bus_clk
(
APB_CLK_FREQ
,
clk_speed
,
&
clk_cal
);
i2c_ll_
master_
cal_bus_clk
(
APB_CLK_FREQ
,
clk_speed
,
&
clk_cal
);
i2c_ll_set_source_clk
(
i2c
->
dev
,
SOC_MOD_CLK_APB
);
/*!< I2C source clock from APB, 80M*/
#elif SOC_I2C_SUPPORT_XTAL
i2c_ll_cal_bus_clk
(
XTAL_CLK_FREQ
,
clk_speed
,
&
clk_cal
);
i2c_ll_
master_
cal_bus_clk
(
XTAL_CLK_FREQ
,
clk_speed
,
&
clk_cal
);
i2c_ll_set_source_clk
(
i2c
->
dev
,
SOC_MOD_CLK_XTAL
);
/*!< I2C source clock from XTAL, 40M */
#endif
i2c_ll_set_txfifo_empty_thr
(
i2c
->
dev
,
a
);
i2c_ll_set_rxfifo_full_thr
(
i2c
->
dev
,
SOC_I2C_FIFO_LEN
-
a
);
i2c_ll_set_bus_timing
(
i2c
->
dev
,
&
clk_cal
);
i2c_ll_set_filter
(
i2c
->
dev
,
3
);
i2c_ll_
master_
set_bus_timing
(
i2c
->
dev
,
&
clk_cal
);
i2c_ll_
master_
set_filter
(
i2c
->
dev
,
3
);
return
true
;
}
...
...
cores/esp32/esp32-hal-touch.c
View file @
e1673e4c
...
...
@@ -22,10 +22,10 @@
Internal Private Touch Data Structure and Functions
*/
#if SOC_TOUCH_
VERSION_
1 // ESP32
#if SOC_TOUCH_
SENSOR_VERSION ==
1 // ESP32
static
uint16_t
__touchSleepCycles
=
0x1000
;
static
uint16_t
__touchMeasureCycles
=
0x1000
;
#elif SOC_TOUCH_
VERSION_
2 // ESP32S2, ESP32S3
#elif SOC_TOUCH_
SENSOR_VERSION ==
2 // ESP32S2, ESP32S3
static
uint16_t
__touchSleepCycles
=
TOUCH_PAD_SLEEP_CYCLE_DEFAULT
;
static
uint16_t
__touchMeasureCycles
=
TOUCH_PAD_MEASURE_CYCLE_DEFAULT
;
#endif
...
...
@@ -37,7 +37,7 @@ typedef struct {
voidFuncPtr
fn
;
bool
callWithArgs
;
void
*
arg
;
#if SOC_TOUCH_
VERSION_
2 // Only for ESP32S2 and ESP32S3
#if SOC_TOUCH_
SENSOR_VERSION ==
2 // Only for ESP32S2 and ESP32S3
bool
lastStatusIsPressed
;
#endif
}
TouchInterruptHandle_t
;
...
...
@@ -51,7 +51,7 @@ static bool initialized = false;
static
bool
channels_initialized
[
SOC_TOUCH_SENSOR_NUM
]
=
{
false
};
static
void
ARDUINO_ISR_ATTR
__touchISR
(
void
*
arg
)
{
#if SOC_TOUCH_
VERSION_
1 // ESP32
#if SOC_TOUCH_
SENSOR_VERSION ==
1 // ESP32
uint32_t
pad_intr
=
touch_pad_get_status
();
//clear interrupt
touch_pad_clear_status
();
...
...
@@ -68,7 +68,7 @@ static void ARDUINO_ISR_ATTR __touchISR(void *arg) {
}
}
}
#elif SOC_TOUCH_
VERSION_
2 // ESP32S2, ESP32S3
#elif SOC_TOUCH_
SENSOR_VERSION ==
2 // ESP32S2, ESP32S3
touch_pad_intr_mask_t
evt
=
touch_pad_read_intr_status_mask
();
uint8_t
pad_num
=
touch_pad_get_current_meas_channel
();
if
(
evt
&
TOUCH_PAD_INTR_MASK_ACTIVE
)
{
...
...
@@ -93,9 +93,9 @@ static void ARDUINO_ISR_ATTR __touchISR(void *arg) {
static
void
__touchSetCycles
(
uint16_t
measure
,
uint16_t
sleep
)
{
__touchSleepCycles
=
sleep
;
__touchMeasureCycles
=
measure
;
#if SOC_TOUCH_
VERSION_
1 // ESP32
#if SOC_TOUCH_
SENSOR_VERSION ==
1 // ESP32
touch_pad_set_measurement_clock_cycles
(
measure
);
#elif SOC_TOUCH_
VERSION_
2 // ESP32S2, ESP32S3
#elif SOC_TOUCH_
SENSOR_VERSION ==
2 // ESP32S2, ESP32S3
touch_pad_set_charge_discharge_times
(
measure
);
#endif
touch_pad_set_measurement_interval
(
sleep
);
...
...
@@ -123,7 +123,7 @@ static void __touchInit() {
esp_err_t
err
=
ESP_OK
;
#if SOC_TOUCH_
VERSION_
1 // ESP32
#if SOC_TOUCH_
SENSOR_VERSION ==
1 // ESP32
err
=
touch_pad_init
();
if
(
err
!=
ESP_OK
)
{
goto
err
;
...
...
@@ -144,7 +144,7 @@ static void __touchInit() {
goto
err
;
}
touch_pad_intr_enable
();
// returns ESP_OK
#elif SOC_TOUCH_
VERSION_2
// ESP32S2, ESP32S3
#elif SOC_TOUCH_
SENSOR_VERSION == 2
// ESP32S2, ESP32S3
err
=
touch_pad_init
();
if
(
err
!=
ESP_OK
)
{
goto
err
;
...
...
@@ -179,11 +179,11 @@ static void __touchChannelInit(int pad) {
return
;
}
#if SOC_TOUCH_
VERSION_
1 // ESP32
#if SOC_TOUCH_
SENSOR_VERSION ==
1 // ESP32
// Initial no Threshold and setup
__touchInterruptHandlers
[
pad
].
fn
=
NULL
;
touch_pad_config
(
pad
,
SOC_
TOUCH_PAD_THRESHOLD_MAX
);
// returns ESP_OK
#elif SOC_TOUCH_
VERSION_2
// ESP32S2, ESP32S3
touch_pad_config
(
pad
,
TOUCH_PAD_THRESHOLD_MAX
);
// returns ESP_OK
#elif SOC_TOUCH_
SENSOR_VERSION == 2
// ESP32S2, ESP32S3
// Initial no Threshold and setup
__touchInterruptHandlers
[
pad
].
fn
=
NULL
;
touch_pad_config
(
pad
);
// returns ESP_OK
...
...
@@ -238,7 +238,7 @@ static void __touchConfigInterrupt(uint8_t pin, void (*userFunc)(void), void *Ar
if
(
userFunc
==
NULL
)
{
// detach ISR User Call
__touchInterruptHandlers
[
pad
].
fn
=
NULL
;
threshold
=
SOC_
TOUCH_PAD_THRESHOLD_MAX
;
// deactivate the ISR with SOC_TOUCH_PAD_THRESHOLD_MAX
threshold
=
TOUCH_PAD_THRESHOLD_MAX
;
// deactivate the ISR with SOC_TOUCH_PAD_THRESHOLD_MAX
}
else
{
// attach ISR User Call
__touchInit
();
...
...
@@ -270,7 +270,7 @@ static void __touchDettachInterrupt(uint8_t pin) {
External Public Touch API Functions
*/
#if SOC_TOUCH_
VERSION_
1 // Only for ESP32 SoC
#if SOC_TOUCH_
SENSOR_VERSION ==
1 // Only for ESP32 SoC
void
touchInterruptSetThresholdDirection
(
bool
mustbeLower
)
{
if
(
mustbeLower
)
{
touch_pad_set_trigger_mode
(
TOUCH_TRIGGER_BELOW
);
...
...
@@ -278,7 +278,7 @@ void touchInterruptSetThresholdDirection(bool mustbeLower) {
touch_pad_set_trigger_mode
(
TOUCH_TRIGGER_ABOVE
);
}
}
#elif SOC_TOUCH_
VERSION_
2 // Only for ESP32S2 and ESP32S3
#elif SOC_TOUCH_
SENSOR_VERSION ==
2 // Only for ESP32S2 and ESP32S3
// returns true if touch pad has been and continues pressed and false otherwise
bool
touchInterruptGetLastStatus
(
uint8_t
pin
)
{
int8_t
pad
=
digitalPinToTouchChannel
(
pin
);
...
...
@@ -307,10 +307,10 @@ void touchSleepWakeUpEnable(uint8_t pin, touch_value_t threshold) {
return
;
}
}
#if SOC_TOUCH_
VERSION_
1 // Only for ESP32 SoC
#if SOC_TOUCH_
SENSOR_VERSION ==
1 // Only for ESP32 SoC
touch_pad_set_thresh
(
pad
,
threshold
);
#elif SOC_TOUCH_
VERSION_
2
#elif SOC_TOUCH_
SENSOR_VERSION ==
2
touch_pad_sleep_channel_enable
(
pad
,
true
);
touch_pad_sleep_set_threshold
(
pad
,
threshold
);
...
...
cores/esp32/esp32-hal-touch.h
View file @
e1673e4c
...
...
@@ -29,13 +29,13 @@ extern "C" {
#include "esp32-hal.h"
#if !
defined(SOC_TOUCH_VERSION_1) && !defined(SOC_TOUCH_VERSION_2)
#if !
SOC_TOUCH_SENSOR_SUPPORTED
#error Touch IDF driver Not supported!
#endif
#if SOC_TOUCH_
VERSION_
1 // ESP32
#if SOC_TOUCH_
SENSOR_VERSION ==
1 // ESP32
typedef
uint16_t
touch_value_t
;
#elif SOC_TOUCH_
VERSION_
2 // ESP32S2 ESP32S3
#elif SOC_TOUCH_
SENSOR_VERSION ==
2 // ESP32S2 ESP32S3
typedef
uint32_t
touch_value_t
;
#endif
...
...
@@ -71,7 +71,7 @@ void touchDetachInterrupt(uint8_t pin);
* Default if Lower.
**/
#if SOC_TOUCH_
VERSION_
1 // Only for ESP32 SoC
#if SOC_TOUCH_
SENSOR_VERSION ==
1 // Only for ESP32 SoC
void
touchInterruptSetThresholdDirection
(
bool
mustbeLower
);
#endif
...
...
@@ -83,7 +83,7 @@ void touchInterruptSetThresholdDirection(bool mustbeLower);
* as soon as the touchpad is touched and/or released
**/
#if SOC_TOUCH_
VERSION_
2 // Only for ESP32S2 and ESP32S3
#if SOC_TOUCH_
SENSOR_VERSION ==
2 // Only for ESP32S2 and ESP32S3
// returns true if touch pad has been and continues pressed and false otherwise
bool
touchInterruptGetLastStatus
(
uint8_t
pin
);
#endif
...
...
cores/esp32/esp32-hal-uart.c
View file @
e1673e4c
...
...
@@ -61,10 +61,10 @@ struct uart_struct_t {
static
uart_t
_uart_bus_array
[]
=
{
{
0
,
false
,
0
,
NULL
,
-
1
,
-
1
,
-
1
,
-
1
,
0
,
0
,
0
,
0
,
false
,
0
},
#if SOC_UART_NUM > 1
#if SOC_UART_
HP_
NUM > 1
{
1
,
false
,
0
,
NULL
,
-
1
,
-
1
,
-
1
,
-
1
,
0
,
0
,
0
,
0
,
false
,
0
},
#endif
#if SOC_UART_NUM > 2
#if SOC_UART_
HP_
NUM > 2
{
2
,
false
,
0
,
NULL
,
-
1
,
-
1
,
-
1
,
-
1
,
0
,
0
,
0
,
0
,
false
,
0
},
#endif
};
...
...
@@ -81,10 +81,10 @@ static uart_t _uart_bus_array[] = {
static
uart_t
_uart_bus_array
[]
=
{
{
NULL
,
0
,
false
,
0
,
NULL
,
-
1
,
-
1
,
-
1
,
-
1
,
0
,
0
,
0
,
0
,
false
,
0
},
#if SOC_UART_NUM > 1
#if SOC_UART_
HP_
NUM > 1
{
NULL
,
1
,
false
,
0
,
NULL
,
-
1
,
-
1
,
-
1
,
-
1
,
0
,
0
,
0
,
0
,
false
,
0
},
#endif
#if SOC_UART_NUM > 2
#if SOC_UART_
HP_
NUM > 2
{
NULL
,
2
,
false
,
0
,
NULL
,
-
1
,
-
1
,
-
1
,
-
1
,
0
,
0
,
0
,
0
,
false
,
0
},
#endif
};
...
...
@@ -94,8 +94,8 @@ static uart_t _uart_bus_array[] = {
// Negative Pin Number will keep it unmodified, thus this function can detach individual pins
// This function will also unset the pins in the Peripheral Manager and set the pin to -1 after detaching
static
bool
_uartDetachPins
(
uint8_t
uart_num
,
int8_t
rxPin
,
int8_t
txPin
,
int8_t
ctsPin
,
int8_t
rtsPin
)
{
if
(
uart_num
>=
SOC_UART_NUM
)
{
log_e
(
"Serial number is invalid, please use number from 0 to %u"
,
SOC_UART_NUM
-
1
);
if
(
uart_num
>=
SOC_UART_
HP_
NUM
)
{
log_e
(
"Serial number is invalid, please use number from 0 to %u"
,
SOC_UART_
HP_
NUM
-
1
);
return
false
;
}
// get UART information
...
...
@@ -181,8 +181,8 @@ static bool _uartDetachBus_RTS(void *busptr) {
// Attach function for UART
// connects the IO Pad, set Paripheral Manager and internal UART structure data
static
bool
_uartAttachPins
(
uint8_t
uart_num
,
int8_t
rxPin
,
int8_t
txPin
,
int8_t
ctsPin
,
int8_t
rtsPin
)
{
if
(
uart_num
>=
SOC_UART_NUM
)
{
log_e
(
"Serial number is invalid, please use number from 0 to %u"
,
SOC_UART_NUM
-
1
);
if
(
uart_num
>=
SOC_UART_
HP_
NUM
)
{
log_e
(
"Serial number is invalid, please use number from 0 to %u"
,
SOC_UART_
HP_
NUM
-
1
);
return
false
;
}
// get UART information
...
...
@@ -308,8 +308,8 @@ bool uartIsDriverInstalled(uart_t *uart) {
// Negative Pin Number will keep it unmodified, thus this function can set individual pins
// When pins are changed, it will detach the previous one
bool
uartSetPins
(
uint8_t
uart_num
,
int8_t
rxPin
,
int8_t
txPin
,
int8_t
ctsPin
,
int8_t
rtsPin
)
{
if
(
uart_num
>=
SOC_UART_NUM
)
{
log_e
(
"Serial number is invalid, please use number from 0 to %u"
,
SOC_UART_NUM
-
1
);
if
(
uart_num
>=
SOC_UART_
HP_
NUM
)
{
log_e
(
"Serial number is invalid, please use number from 0 to %u"
,
SOC_UART_
HP_
NUM
-
1
);
return
false
;
}
// get UART information
...
...
@@ -378,7 +378,7 @@ bool _testUartBegin(
uint8_t
uart_nr
,
uint32_t
baudrate
,
uint32_t
config
,
int8_t
rxPin
,
int8_t
txPin
,
uint32_t
rx_buffer_size
,
uint32_t
tx_buffer_size
,
bool
inverted
,
uint8_t
rxfifo_full_thrhd
)
{
if
(
uart_nr
>=
SOC_UART_NUM
)
{
if
(
uart_nr
>=
SOC_UART_
HP_
NUM
)
{
return
false
;
// no new driver has to be installed
}
uart_t
*
uart
=
&
_uart_bus_array
[
uart_nr
];
...
...
@@ -400,8 +400,8 @@ uart_t *uartBegin(
uint8_t
uart_nr
,
uint32_t
baudrate
,
uint32_t
config
,
int8_t
rxPin
,
int8_t
txPin
,
uint32_t
rx_buffer_size
,
uint32_t
tx_buffer_size
,
bool
inverted
,
uint8_t
rxfifo_full_thrhd
)
{
if
(
uart_nr
>=
SOC_UART_NUM
)
{
log_e
(
"UART number is invalid, please use number from 0 to %u"
,
SOC_UART_NUM
-
1
);
if
(
uart_nr
>=
SOC_UART_
HP_
NUM
)
{
log_e
(
"UART number is invalid, please use number from 0 to %u"
,
SOC_UART_
HP_
NUM
-
1
);
return
NULL
;
// no new driver was installed
}
uart_t
*
uart
=
&
_uart_bus_array
[
uart_nr
];
...
...
@@ -604,8 +604,8 @@ bool uartSetRxFIFOFull(uart_t *uart, uint8_t numBytesFIFOFull) {
}
void
uartEnd
(
uint8_t
uart_num
)
{
if
(
uart_num
>=
SOC_UART_NUM
)
{
log_e
(
"Serial number is invalid, please use number from 0 to %u"
,
SOC_UART_NUM
-
1
);
if
(
uart_num
>=
SOC_UART_
HP_
NUM
)
{
log_e
(
"Serial number is invalid, please use number from 0 to %u"
,
SOC_UART_
HP_
NUM
-
1
);
return
;
}
// get UART information
...
...
@@ -819,14 +819,14 @@ static void ARDUINO_ISR_ATTR uart0_write_char(char c) {
uart_ll_write_txfifo
(
&
UART0
,
(
const
uint8_t
*
)
&
c
,
1
);
}
#if SOC_UART_NUM > 1
#if SOC_UART_
HP_
NUM > 1
static
void
ARDUINO_ISR_ATTR
uart1_write_char
(
char
c
)
{
while
(
uart_ll_get_txfifo_len
(
&
UART1
)
==
0
);
uart_ll_write_txfifo
(
&
UART1
,
(
const
uint8_t
*
)
&
c
,
1
);
}
#endif
#if SOC_UART_NUM > 2
#if SOC_UART_
HP_
NUM > 2
static
void
ARDUINO_ISR_ATTR
uart2_write_char
(
char
c
)
{
while
(
uart_ll_get_txfifo_len
(
&
UART2
)
==
0
);
uart_ll_write_txfifo
(
&
UART2
,
(
const
uint8_t
*
)
&
c
,
1
);
...
...
@@ -836,10 +836,10 @@ static void ARDUINO_ISR_ATTR uart2_write_char(char c) {
void
uart_install_putc
()
{
switch
(
s_uart_debug_nr
)
{
case
0
:
ets_install_putc1
((
void
(
*
)(
char
))
&
uart0_write_char
);
break
;
#if SOC_UART_NUM > 1
#if SOC_UART_
HP_
NUM > 1
case
1
:
ets_install_putc1
((
void
(
*
)(
char
))
&
uart1_write_char
);
break
;
#endif
#if SOC_UART_NUM > 2
#if SOC_UART_
HP_
NUM > 2
case
2
:
ets_install_putc1
((
void
(
*
)(
char
))
&
uart2_write_char
);
break
;
#endif
default:
ets_install_putc1
(
NULL
);
break
;
...
...
@@ -850,7 +850,7 @@ void uart_install_putc() {
// Routines that take care of UART mode in the HardwareSerial Class code
// used to set UART_MODE_RS485_HALF_DUPLEX auto RTS for TXD for ESP32 chips
bool
uartSetMode
(
uart_t
*
uart
,
uart_mode_t
mode
)
{
if
(
uart
==
NULL
||
uart
->
num
>=
SOC_UART_NUM
)
{
if
(
uart
==
NULL
||
uart
->
num
>=
SOC_UART_
HP_
NUM
)
{
return
false
;
}
...
...
@@ -861,7 +861,7 @@ bool uartSetMode(uart_t *uart, uart_mode_t mode) {
}
void
uartSetDebug
(
uart_t
*
uart
)
{
if
(
uart
==
NULL
||
uart
->
num
>=
SOC_UART_NUM
)
{
if
(
uart
==
NULL
||
uart
->
num
>=
SOC_UART_
HP_
NUM
)
{
s_uart_debug_nr
=
-
1
;
}
else
{
s_uart_debug_nr
=
uart
->
num
;
...
...
@@ -1103,7 +1103,7 @@ unsigned long uartDetectBaudrate(uart_t *uart) {
*/
// gets the right TX or RX SIGNAL, based on the UART number from gpio_sig_map.h
#if SOC_UART_NUM > 2
#if SOC_UART_
HP_
NUM > 2
#define UART_TX_SIGNAL(uartNumber) (uartNumber == UART_NUM_0 ? U0TXD_OUT_IDX : (uartNumber == UART_NUM_1 ? U1TXD_OUT_IDX : U2TXD_OUT_IDX))
#define UART_RX_SIGNAL(uartNumber) (uartNumber == UART_NUM_0 ? U0RXD_IN_IDX : (uartNumber == UART_NUM_1 ? U1RXD_IN_IDX : U2RXD_IN_IDX))
#else
...
...
@@ -1115,7 +1115,7 @@ unsigned long uartDetectBaudrate(uart_t *uart) {
This creates a loop that lets us receive anything we send on the UART without external wires.
*/
void
uart_internal_loopback
(
uint8_t
uartNum
,
int8_t
rxPin
)
{
if
(
uartNum
>
SOC_UART_NUM
-
1
||
!
GPIO_IS_VALID_GPIO
(
rxPin
))
{
if
(
uartNum
>
SOC_UART_
HP_
NUM
-
1
||
!
GPIO_IS_VALID_GPIO
(
rxPin
))
{
return
;
}
esp_rom_gpio_connect_out_signal
(
rxPin
,
UART_TX_SIGNAL
(
uartNum
),
false
,
false
);
...
...
idf_component.yml
View file @
e1673e4c
...
...
@@ -42,7 +42,7 @@ files:
-
"
platform.txt"
-
"
programmers.txt"
dependencies
:
idf
:
"
>=5.
1,<5.2
"
idf
:
"
>=5.
3,<5.4
"
# mdns 1.2.1 is necessary to build H2 with no WiFi
espressif/mdns
:
version
:
"
^1.2.3"
...
...
libraries/BluetoothSerial/examples/SerialToSerialBT_Legacy/SerialToSerialBT_Legacy.ino
View file @
e1673e4c
...
...
@@ -17,12 +17,6 @@
#error Serial Port Profile for Bluetooth is not available or not enabled. It is only available for the ESP32 chip.
#endif
// Check Simple Secure Pairing
#if defined(CONFIG_BT_SSP_ENABLED)
#warning Legacy Pairing is disabled (CONFIG_BT_SSP_ENABLED is enabled. Disable it in menuconfig).
void
setup
()
{}
void
loop
()
{}
#else
const
char
*
deviceName
=
"ESP32_Legacy_example"
;
BluetoothSerial
SerialBT
;
...
...
@@ -62,4 +56,3 @@ void loop() {
delay
(
1
);
// Feed the watchdog
}
}
#endif
libraries/BluetoothSerial/examples/SerialToSerialBT_SSP/SerialToSerialBT_SSP.ino
View file @
e1673e4c
...
...
@@ -22,11 +22,6 @@
#error Serial Port Profile for Bluetooth is not available or not enabled. It is only available for the ESP32 chip.
#endif
// Check Simple Secure Pairing
#if !defined(CONFIG_BT_SSP_ENABLED)
#error Simple Secure Pairing for Bluetooth is not available or not enabled.
#endif
const
char
*
deviceName
=
"ESP32_SSP_example"
;
// The following lines defines the method of pairing
...
...
libraries/BluetoothSerial/src/BluetoothSerial.cpp
View file @
e1673e4c
...
...
@@ -71,11 +71,9 @@ static esp_bd_addr_t _peer_bd_addr;
static
char
_remote_name
[
ESP_BT_GAP_MAX_BDNAME_LEN
+
1
];
static
bool
_isRemoteAddressSet
;
static
bool
_isMaster
;
#ifdef CONFIG_BT_SSP_ENABLED
static
bool
_enableSSP
;
static
bool
_IO_CAP_INPUT
;
static
bool
_IO_CAP_OUTPUT
;
#endif
esp_bt_pin_code_t
_pin_code
=
{
0
};
uint8_t
_pin_code_len
=
0
;
// Number of valid Bytes in the esp_bt_pin_code_t array
static
esp_spp_sec_t
_sec_mask
;
...
...
@@ -538,7 +536,6 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
esp_bt_gap_pin_reply
(
param
->
pin_req
.
bda
,
true
,
_pin_code_len
,
_pin_code
);
}
break
;
#ifdef CONFIG_BT_SSP_ENABLED
case
ESP_BT_GAP_CFM_REQ_EVT
:
// Enum 6 - Security Simple Pairing User Confirmation request.
log_i
(
"ESP_BT_GAP_CFM_REQ_EVT Please compare the numeric value: %d"
,
param
->
cfm_req
.
num_val
);
if
(
confirm_request_callback
)
{
...
...
@@ -549,13 +546,10 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
esp_bt_gap_ssp_confirm_reply
(
param
->
cfm_req
.
bda
,
false
);
}
break
;
#endif
case
ESP_BT_GAP_KEY_NOTIF_EVT
:
// Enum 7 - Security Simple Pairing Passkey Notification
log_i
(
"ESP_BT_GAP_KEY_NOTIF_EVT passkey:%d"
,
param
->
key_notif
.
passkey
);
break
;
#ifdef CONFIG_BT_SSP_ENABLED
case
ESP_BT_GAP_KEY_REQ_EVT
:
// Enum 8 - Security Simple Pairing Passkey request
log_i
(
"ESP_BT_GAP_KEY_REQ_EVT Please enter passkey!"
);
if
(
key_request_callback
)
{
...
...
@@ -566,7 +560,6 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
esp_bt_gap_ssp_confirm_reply
(
param
->
cfm_req
.
bda
,
false
);
}
break
;
#endif
case
ESP_BT_GAP_READ_RSSI_DELTA_EVT
:
// Enum 9 - Read rssi event
log_i
(
"ESP_BT_GAP_READ_RSSI_DELTA_EVT Read rssi event"
);
...
...
@@ -707,7 +700,6 @@ static bool _init_bt(const char *deviceName, bt_mode mode) {
log_i
(
"device name set"
);
esp_bt_dev_set_device_name
(
deviceName
);
#ifdef CONFIG_BT_SSP_ENABLED
if
(
_enableSSP
)
{
log_i
(
"Simple Secure Pairing"
);
esp_bt_sp_param_t
param_type
=
ESP_BT_SP_IOCAP_MODE
;
...
...
@@ -723,7 +715,6 @@ static bool _init_bt(const char *deviceName, bt_mode mode) {
}
esp_bt_gap_set_security_param
(
param_type
,
&
iocap
,
sizeof
(
uint8_t
));
}
#endif
// the default BTA_DM_COD_LOUDSPEAKER does not work with the macOS BT stack
esp_bt_cod_t
cod
;
...
...
@@ -894,7 +885,6 @@ void BluetoothSerial::memrelease() {
esp_bt_mem_release
(
ESP_BT_MODE_BTDM
);
}
#ifdef CONFIG_BT_SSP_ENABLED
void
BluetoothSerial
::
onConfirmRequest
(
ConfirmRequestCb
cb
)
{
confirm_request_callback
=
cb
;
}
...
...
@@ -906,7 +896,6 @@ void BluetoothSerial::onKeyRequest(KeyRequestCb cb) {
void
BluetoothSerial
::
respondPasskey
(
uint32_t
passkey
)
{
esp_bt_gap_ssp_passkey_reply
(
current_bd_addr
,
true
,
passkey
);
}
#endif
void
BluetoothSerial
::
onAuthComplete
(
AuthCompleteCb
cb
)
{
auth_complete_callback
=
cb
;
...
...
@@ -921,7 +910,6 @@ esp_err_t BluetoothSerial::register_callback(esp_spp_cb_t callback) {
return
ESP_OK
;
}
#ifdef CONFIG_BT_SSP_ENABLED
// Enable Simple Secure Pairing (using generated PIN)
// This must be called before calling begin, otherwise has no effect!
void
BluetoothSerial
::
enableSSP
()
{
...
...
@@ -957,8 +945,6 @@ void BluetoothSerial::disableSSP() {
_enableSSP
=
false
;
}
#else
bool
BluetoothSerial
::
setPin
(
const
char
*
pin
,
uint8_t
pin_code_len
)
{
if
(
pin_code_len
==
0
||
pin_code_len
>
16
)
{
log_e
(
"PIN code must be 1-16 Bytes long! Called with length %d"
,
pin_code_len
);
...
...
@@ -968,7 +954,6 @@ bool BluetoothSerial::setPin(const char *pin, uint8_t pin_code_len) {
memcpy
(
_pin_code
,
pin
,
pin_code_len
);
return
(
esp_bt_gap_set_pin
(
ESP_BT_PIN_TYPE_FIXED
,
_pin_code_len
,
_pin_code
)
==
ESP_OK
);
}
#endif
bool
BluetoothSerial
::
connect
(
String
remoteName
)
{
bool
retval
=
false
;
...
...
libraries/BluetoothSerial/src/BluetoothSerial.h
View file @
e1673e4c
...
...
@@ -56,21 +56,16 @@ public:
void
onData
(
BluetoothSerialDataCb
cb
);
esp_err_t
register_callback
(
esp_spp_cb_t
callback
);
#ifdef CONFIG_BT_SSP_ENABLED
void
onConfirmRequest
(
ConfirmRequestCb
cb
);
void
onKeyRequest
(
KeyRequestCb
cb
);
void
respondPasskey
(
uint32_t
passkey
);
#endif
void
onAuthComplete
(
AuthCompleteCb
cb
);
void
confirmReply
(
boolean
confirm
);
#ifdef CONFIG_BT_SSP_ENABLED
void
enableSSP
();
void
enableSSP
(
bool
inputCapability
,
bool
outputCapability
);
void
disableSSP
();
#else
bool
setPin
(
const
char
*
pin
,
uint8_t
pin_code_len
);
#endif
bool
connect
(
String
remoteName
);
bool
connect
(
uint8_t
remoteAddress
[],
int
channel
=
0
,
esp_spp_sec_t
sec_mask
=
(
ESP_SPP_SEC_ENCRYPT
|
ESP_SPP_SEC_AUTHENTICATE
),
...
...
libraries/ESP32/examples/Serial/Serial_STD_Func_OnReceive/Serial_STD_Func_OnReceive.ino
View file @
e1673e4c
...
...
@@ -11,7 +11,7 @@
*/
// soc/soc_caps.h has information about each SoC target
// in this example, we use SOC_UART_NUM that goes from 1 to 3,
// in this example, we use SOC_UART_
HP_
NUM that goes from 1 to 3,
// depending on the number of available UARTs in the ESP32xx
// This makes the code transparent to what SoC is used.
#include "soc/soc_caps.h"
...
...
@@ -24,9 +24,9 @@
#define TXPIN 5 // GPIO 5 => TX for Serial1 or Serial2
// declare testingSerial (as reference) related to TEST_UART number defined above (only for Serial1 and Serial2)
#if SOC_UART_NUM > 1 && TEST_UART == 1
#if SOC_UART_
HP_
NUM > 1 && TEST_UART == 1
HardwareSerial
&
testingSerial
=
Serial1
;
#elif SOC_UART_NUM > 2 && TEST_UART == 2
#elif SOC_UART_
HP_
NUM > 2 && TEST_UART == 2
HardwareSerial
&
testingSerial
=
Serial2
;
#endif
...
...
@@ -36,11 +36,11 @@ void processOnReceiving(HardwareSerial &mySerial) {
int8_t
uart_num
=
-
1
;
if
(
&
mySerial
==
&
Serial0
)
{
uart_num
=
0
;
#if SOC_UART_NUM > 1
#if SOC_UART_
HP_
NUM > 1
}
else
if
(
&
mySerial
==
&
Serial1
)
{
uart_num
=
1
;
#endif
#if SOC_UART_NUM > 2
#if SOC_UART_
HP_
NUM > 2
}
else
if
(
&
mySerial
==
&
Serial2
)
{
uart_num
=
2
;
#endif
...
...
libraries/ESP_I2S/src/ESP_I2S.cpp
View file @
e1673e4c
...
...
@@ -819,7 +819,7 @@ size_t I2SClass::readBytes(char *buffer, size_t size) {
return
total_size
;
}
size_t
I2SClass
::
write
(
uint8_t
*
buffer
,
size_t
size
)
{
size_t
I2SClass
::
write
(
const
uint8_t
*
buffer
,
size_t
size
)
{
size_t
written
=
0
;
size_t
bytes_sent
=
0
;
last_error
=
ESP_FAIL
;
...
...
libraries/ESP_I2S/src/ESP_I2S.h
View file @
e1673e4c
...
...
@@ -62,7 +62,7 @@ public:
bool
end
();
size_t
readBytes
(
char
*
buffer
,
size_t
size
);
size_t
write
(
uint8_t
*
buffer
,
size_t
size
);
size_t
write
(
const
uint8_t
*
buffer
,
size_t
size
);
i2s_chan_handle_t
txChan
();
uint32_t
txSampleRate
();
...
...
libraries/Ethernet/src/ETH.cpp
View file @
e1673e4c
...
...
@@ -170,6 +170,11 @@ bool ETHClass::begin(eth_phy_type_t type, int32_t phy_addr, int mdc, int mdio, i
Network
.
begin
();
_ethernets
[
_eth_index
]
=
this
;
#if CONFIG_IDF_TARGET_ESP32
#undef DEFAULT_RMII_CLK_GPIO
#define DEFAULT_RMII_CLK_GPIO (emac_rmii_clock_gpio_t)(CONFIG_ETH_RMII_CLK_IN_GPIO)
#endif
eth_esp32_emac_config_t
mac_config
=
ETH_ESP32_EMAC_DEFAULT_CONFIG
();
mac_config
.
clock_config
.
rmii
.
clock_mode
=
(
clock_mode
)
?
EMAC_CLK_OUT
:
EMAC_CLK_EXT_IN
;
mac_config
.
clock_config
.
rmii
.
clock_gpio
=
(
1
==
clock_mode
)
?
EMAC_APPL_CLK_OUT_GPIO
...
...
libraries/Insights/examples/DiagnosticsSmokeTest/DiagnosticsSmokeTest.ino
View file @
e1673e4c
...
...
@@ -36,7 +36,8 @@ static void smoke_test() {
Insights
.
event
(
TAG
,
"[count][%d]"
,
count
);
}
else
{
log_e
(
"[count][%d] [crash_count][%"
PRIu32
"] [excvaddr][0x0f] Crashing..."
,
count
,
s_reset_count
);
*
(
int
*
)
0x0F
=
0x10
;
//ToDo: find better way to crash
//*(int *)0x0F = 0x10;
}
}
...
...
libraries/Network/src/NetworkClient.h
View file @
e1673e4c
...
...
@@ -28,8 +28,6 @@ class NetworkClientRxBuffer;
class
ESPLwIPClient
:
public
Client
{
public:
virtual
int
connect
(
IPAddress
ip
,
uint16_t
port
,
int32_t
timeout
)
=
0
;
virtual
int
connect
(
const
char
*
host
,
uint16_t
port
,
int32_t
timeout
)
=
0
;
virtual
void
setConnectionTimeout
(
uint32_t
milliseconds
)
=
0
;
};
...
...
libraries/PPP/src/PPP.cpp
View file @
e1673e4c
...
...
@@ -279,7 +279,7 @@ bool PPPClass::begin(ppp_modem_model_t model, uint8_t uart_num, int baud_rate) {
dte_config
.
uart_config
.
flow_control
=
_flow_ctrl
;
dte_config
.
uart_config
.
rx_buffer_size
=
_rx_buffer_size
;
dte_config
.
uart_config
.
tx_buffer_size
=
_tx_buffer_size
;
dte_config
.
uart_config
.
port_num
=
_uart_num
;
dte_config
.
uart_config
.
port_num
=
(
uart_port_t
)
_uart_num
;
dte_config
.
uart_config
.
baud_rate
=
baud_rate
;
/* Configure the DCE */
...
...
package/package_esp32_index.template.json
View file @
e1673e4c
This diff is collapsed.
Click to expand it.
platform.txt
View file @
e1673e4c
...
...
@@ -3,9 +3,7 @@ version=3.0.4
tools.esp32-arduino-libs.path={runtime.platform.path}/tools/esp32-arduino-libs
tools.esp32-arduino-libs.path.windows={runtime.platform.path}\tools\esp32-arduino-libs
tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32-elf
tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s2-elf
tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s3-elf
tools.xtensa-esp-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp-elf
tools.xtensa-esp-elf-gdb.path={runtime.platform.path}/tools/xtensa-esp-elf-gdb
tools.riscv32-esp-elf-gcc.path={runtime.platform.path}/tools/riscv32-esp-elf
tools.riscv32-esp-elf-gdb.path={runtime.platform.path}/tools/riscv32-esp-elf-gdb
...
...
@@ -27,7 +25,7 @@ tools.gen_esp32part.cmd.windows="{runtime.platform.path}\tools\gen_esp32part.exe
tools.gen_insights_pkg.cmd=python3 "{runtime.platform.path}"/tools/gen_insights_package.py
tools.gen_insights_pkg.cmd.windows="{runtime.platform.path}\tools\gen_insights_package.exe"
compiler.path={tools.{build.tarch}-
{build.target}
-elf-gcc.path}/bin/
compiler.path={tools.{build.tarch}-
esp
-elf-gcc.path}/bin/
compiler.prefix={build.tarch}-{build.target}-elf-
compiler.sdk.path={tools.esp32-arduino-libs.path}/{build.mcu}
...
...
tests/validation/uart/uart.ino
View file @
e1673e4c
...
...
@@ -46,7 +46,7 @@
*
*/
#if SOC_UART_NUM == 2
#if SOC_UART_
HP_
NUM == 2
// Used for the pin swap test
#define NEW_RX1 9
#define NEW_TX1 10
...
...
@@ -64,14 +64,14 @@ extern int8_t uart_get_TxPin(uint8_t uart_num);
// This function starts all the available test UARTs
void
start_serial
(
unsigned
long
baudrate
=
115200
)
{
#if SOC_UART_NUM >= 2
#if SOC_UART_
HP_
NUM >= 2
Serial1
.
begin
(
baudrate
);
while
(
!
Serial1
)
{
delay
(
10
);
}
#endif
#if SOC_UART_NUM >= 3
#if SOC_UART_
HP_
NUM >= 3
Serial2
.
begin
(
baudrate
);
while
(
!
Serial2
)
{
delay
(
10
);
...
...
@@ -81,11 +81,11 @@ void start_serial(unsigned long baudrate = 115200) {
// This function stops all the available test UARTs
void
stop_serial
(
bool
hard_stop
=
false
)
{
#if SOC_UART_NUM >= 2
#if SOC_UART_
HP_
NUM >= 2
Serial1
.
end
(
/*hard_stop*/
);
#endif
#if SOC_UART_NUM >= 3
#if SOC_UART_
HP_
NUM >= 3
Serial2
.
end
(
/*hard_stop*/
);
#endif
}
...
...
@@ -93,14 +93,14 @@ void stop_serial(bool hard_stop = false) {
// This function transmits a message and checks if it was received correctly
void
transmit_and_check_msg
(
const
String
msg_append
,
bool
perform_assert
=
true
)
{
delay
(
100
);
// Wait for some settings changes to take effect
#if SOC_UART_NUM == 2
#if SOC_UART_
HP_
NUM == 2
Serial1
.
print
(
"Hello from Serial1 (UART1) >>> via loopback >>> Serial1 (UART1) "
+
msg_append
);
Serial1
.
flush
();
delay
(
100
);
if
(
perform_assert
)
{
TEST_ASSERT_EQUAL_STRING
((
"Hello from Serial1 (UART1) >>> via loopback >>> Serial1 (UART1) "
+
msg_append
).
c_str
(),
recv_msg
.
c_str
());
}
#elif SOC_UART_NUM == 3
#elif SOC_UART_
HP_
NUM == 3
Serial1
.
print
(
"Hello from Serial1 (UART1) >>> to >>> Serial2 (UART2) "
+
msg_append
);
Serial1
.
flush
();
delay
(
100
);
...
...
@@ -126,9 +126,9 @@ void transmit_and_check_msg(const String msg_append, bool perform_assert = true)
void
task_delayed_msg
(
void
*
pvParameters
)
{
HardwareSerial
*
selected_serial
;
#if SOC_UART_NUM == 2
#if SOC_UART_
HP_
NUM == 2
selected_serial
=
&
Serial
;
#elif SOC_UART_NUM == 3
#elif SOC_UART_
HP_
NUM == 3
selected_serial
=
&
Serial1
;
#endif
...
...
@@ -143,14 +143,14 @@ void task_delayed_msg(void *pvParameters) {
// This function is automatically called by unity before each test is run
void
setUp
(
void
)
{
start_serial
(
115200
);
#if SOC_UART_NUM == 2
#if SOC_UART_
HP_
NUM == 2
log_d
(
"Setup internal loop-back from and back to Serial1 (UART1) TX >> Serial1 (UART1) RX"
);
Serial1
.
onReceive
([]()
{
onReceive_cb
(
Serial1
);
});
uart_internal_loopback
(
1
,
RX1
);
#elif SOC_UART_NUM == 3
#elif SOC_UART_
HP_
NUM == 3
log_d
(
"Setup internal loop-back between Serial1 (UART1) <<--->> Serial2 (UART2)"
);
Serial1
.
onReceive
([]()
{
...
...
@@ -180,11 +180,11 @@ void onReceive_cb(HardwareSerial &selected_serial) {
if
(
&
selected_serial
==
&
Serial
)
{
uart_num
=
0
;
#if SOC_UART_NUM >= 2
#if SOC_UART_
HP_
NUM >= 2
}
else
if
(
&
selected_serial
==
&
Serial1
)
{
uart_num
=
1
;
#endif
#if SOC_UART_NUM >= 3
#if SOC_UART_
HP_
NUM >= 3
}
else
if
(
&
selected_serial
==
&
Serial2
)
{
uart_num
=
2
;
#endif
...
...
@@ -225,7 +225,7 @@ void change_baudrate_test(void) {
Serial1
.
updateBaudRate
(
9600
);
TEST_ASSERT_UINT_WITHIN
(
192
,
9600
,
Serial1
.
baudRate
());
#if SOC_UART_NUM == 3
#if SOC_UART_
HP_
NUM == 3
Serial2
.
updateBaudRate
(
9600
);
TEST_ASSERT_UINT_WITHIN
(
192
,
9600
,
Serial2
.
baudRate
());
#endif
...
...
@@ -239,7 +239,7 @@ void change_baudrate_test(void) {
//Baudrate error should be within 2% of the target baudrate
TEST_ASSERT_UINT_WITHIN
(
2304
,
115200
,
Serial1
.
baudRate
());
#if SOC_UART_NUM == 3
#if SOC_UART_
HP_
NUM == 3
TEST_ASSERT_UINT_WITHIN
(
2304
,
115200
,
Serial2
.
baudRate
());
#endif
...
...
@@ -419,20 +419,20 @@ void change_pins_test(void) {
log_d
(
"Disabling UART loopback"
);
#if SOC_UART_NUM == 2
#if SOC_UART_
HP_
NUM == 2
esp_rom_gpio_connect_out_signal
(
SOC_RX0
,
SIG_GPIO_OUT_IDX
,
false
,
false
);
#elif SOC_UART_NUM == 3
#elif SOC_UART_
HP_
NUM == 3
esp_rom_gpio_connect_out_signal
(
RX1
,
SIG_GPIO_OUT_IDX
,
false
,
false
);
esp_rom_gpio_connect_out_signal
(
RX2
,
SIG_GPIO_OUT_IDX
,
false
,
false
);
#endif
log_d
(
"Swapping UART pins"
);
#if SOC_UART_NUM == 2
#if SOC_UART_
HP_
NUM == 2
Serial1
.
setPins
(
NEW_RX1
,
NEW_TX1
);
TEST_ASSERT_EQUAL
(
NEW_RX1
,
uart_get_RxPin
(
1
));
TEST_ASSERT_EQUAL
(
NEW_TX1
,
uart_get_TxPin
(
1
));
#elif SOC_UART_NUM == 3
#elif SOC_UART_
HP_
NUM == 3
Serial1
.
setPins
(
RX2
,
TX2
);
Serial2
.
setPins
(
RX1
,
TX1
);
TEST_ASSERT_EQUAL
(
RX2
,
uart_get_RxPin
(
1
));
...
...
@@ -445,9 +445,9 @@ void change_pins_test(void) {
log_d
(
"Re-enabling UART loopback"
);
#if SOC_UART_NUM == 2
#if SOC_UART_
HP_
NUM == 2
uart_internal_loopback
(
1
,
NEW_RX1
);
#elif SOC_UART_NUM == 3
#elif SOC_UART_
HP_
NUM == 3
uart_internal_loopback
(
1
,
RX1
);
uart_internal_loopback
(
2
,
RX2
);
#endif
...
...
@@ -467,10 +467,10 @@ void auto_baudrate_test(void) {
log_d
(
"Stopping test serial. Using Serial2 for ESP32 and Serial1 for ESP32-S2."
);
#if SOC_UART_NUM == 2
#if SOC_UART_
HP_
NUM == 2
selected_serial
=
&
Serial1
;
uart_internal_loopback
(
0
,
RX1
);
#elif SOC_UART_NUM == 3
#elif SOC_UART_
HP_
NUM == 3
selected_serial
=
&
Serial2
;
#endif
...
...
@@ -485,7 +485,7 @@ void auto_baudrate_test(void) {
selected_serial
->
begin
(
0
);
baudrate
=
selected_serial
->
baudRate
();
#if SOC_UART_NUM == 2
#if SOC_UART_
HP_
NUM == 2
Serial
.
end
();
Serial
.
begin
(
115200
);
#endif
...
...
@@ -504,7 +504,7 @@ void periman_test(void) {
Wire
.
begin
(
RX1
,
TX1
);
#if SOC_UART_NUM == 3
#if SOC_UART_
HP_
NUM == 3
Wire1
.
begin
(
RX2
,
TX2
);
#endif
...
...
@@ -518,11 +518,11 @@ void periman_test(void) {
Serial1
.
setPins
(
RX1
,
TX1
);
#if SOC_UART_NUM == 3
#if SOC_UART_
HP_
NUM == 3
Serial2
.
setPins
(
RX2
,
TX2
);
uart_internal_loopback
(
1
,
RX2
);
uart_internal_loopback
(
2
,
RX1
);
#elif SOC_UART_NUM == 2
#elif SOC_UART_
HP_
NUM == 2
uart_internal_loopback
(
1
,
RX1
);
#endif
...
...
@@ -565,19 +565,19 @@ void setup() {
while
(
!
Serial
)
{
delay
(
10
);
}
log_d
(
"SOC_UART_
NUM = %d"
,
SOC_UART
_NUM
);
log_d
(
"SOC_UART_
HP_NUM = %d"
,
SOC_UART_HP
_NUM
);
// Begin needs to be called before setting up the loopback because it creates the serial object
start_serial
(
115200
);
#if SOC_UART_NUM == 2
#if SOC_UART_
HP_
NUM == 2
log_d
(
"Setup internal loop-back from and back to Serial1 (UART1) TX >> Serial1 (UART1) RX"
);
Serial1
.
onReceive
([]()
{
onReceive_cb
(
Serial1
);
});
uart_internal_loopback
(
1
,
RX1
);
#elif SOC_UART_NUM == 3
#elif SOC_UART_
HP_
NUM == 3
log_d
(
"Setup internal loop-back between Serial1 (UART1) <<--->> Serial2 (UART2)"
);
Serial1
.
onReceive
([]()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment