Commit e1673e4c authored by me-no-dev's avatar me-no-dev

fix(build): IDF release/v5.3 466a392a and initial changes

parent def319ad
...@@ -219,12 +219,8 @@ find "$PKG_DIR" -name '*.git*' -type f -delete ...@@ -219,12 +219,8 @@ find "$PKG_DIR" -name '*.git*' -type f -delete
## ##
RVTC_NAME="riscv32-esp-elf-gcc" RVTC_NAME="riscv32-esp-elf-gcc"
RVTC_NEW_NAME="esp-rv32" RVTC_NEW_NAME="esp-rv32"
X32TC_NAME="xtensa-esp32-elf-gcc" X32TC_NAME="xtensa-esp-elf-gcc"
X32TC_NEW_NAME="esp-x32" 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 # Replace tools locations in platform.txt
echo "Generating platform.txt..." echo "Generating platform.txt..."
...@@ -233,9 +229,7 @@ sed "s/version=.*/version=$RELEASE_TAG/g" | \ ...@@ -233,9 +229,7 @@ sed "s/version=.*/version=$RELEASE_TAG/g" | \
sed 's/tools\.esp32-arduino-libs\.path\.windows=.*//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.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-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-esp-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.riscv32-esp-elf-gdb/\{runtime.tools.riscv32-esp-elf-gdb.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.riscv32-esp-elf/\\{runtime.tools.$RVTC_NEW_NAME.path\\}/g" | \
sed 's/{runtime\.platform\.path}.tools.esptool/\{runtime.tools.esptool_py.path\}/g' | \ sed 's/{runtime\.platform\.path}.tools.esptool/\{runtime.tools.esptool_py.path\}/g' | \
...@@ -355,15 +349,7 @@ rvtc_jq_arg="\ ...@@ -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\")).version = \"$RVTC_VERSION\" |\
(.packages[0].platforms[0].toolsDependencies[] | select(.name==\"$X32TC_NAME\")).name = \"$X32TC_NEW_NAME\" |\ (.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\")).version = \"$RVTC_VERSION\" |\
(.packages[0].tools[] | select(.name==\"$X32TC_NAME\")).name = \"$X32TC_NEW_NAME\" |\ (.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\""
cat "$PACKAGE_JSON_TEMPLATE" | jq "$rvtc_jq_arg" > "$OUTPUT_DIR/package-$LIBS_PROJ_NAME-rvfix.json" 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" PACKAGE_JSON_TEMPLATE="$OUTPUT_DIR/package-$LIBS_PROJ_NAME-rvfix.json"
......
...@@ -194,28 +194,29 @@ jobs: ...@@ -194,28 +194,29 @@ jobs:
- name: Build Sketches - name: Build Sketches
run: bash ./.github/scripts/on-push.sh run: bash ./.github/scripts/on-push.sh
# PlatformIO on Windows, Ubuntu and Mac # # PlatformIO on Windows, Ubuntu and Mac
build-platformio: # build-platformio:
name: PlatformIO on ${{ matrix.os }} # name: PlatformIO on ${{ matrix.os }}
needs: gen-chunks # needs: gen-chunks
if: | # if: |
needs.gen-chunks.outputs.build_all == 'true' || # needs.gen-chunks.outputs.build_all == 'true' ||
needs.gen-chunks.outputs.build_static_sketches == 'true' || # needs.gen-chunks.outputs.build_static_sketches == 'true' ||
needs.gen-chunks.outputs.build_platformio == 'true' # needs.gen-chunks.outputs.build_platformio == 'true'
runs-on: ${{ matrix.os }} # runs-on: ${{ matrix.os }}
strategy: # strategy:
fail-fast: false # fail-fast: false
matrix: # matrix:
os: [ubuntu-latest, windows-latest, macOS-latest] # os: [ubuntu-latest, windows-latest, macOS-latest]
steps: # steps:
- uses: actions/checkout@v4 # - uses: actions/checkout@v4
- uses: actions/setup-python@v5 # - uses: actions/setup-python@v5
with: # with:
python-version: '3.x' # python-version: '3.x'
- name: Build Sketches # - name: Build Sketches
run: bash ./.github/scripts/on-push.sh 1 1 #equal and non-zero to trigger PIO # run: bash ./.github/scripts/on-push.sh 1 1 #equal and non-zero to trigger PIO
# ESP-IDF component build
build-esp-idf-component: build-esp-idf-component:
name: Build with ESP-IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }} name: Build with ESP-IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
needs: gen-chunks needs: gen-chunks
...@@ -231,7 +232,7 @@ jobs: ...@@ -231,7 +232,7 @@ jobs:
# See https://hub.docker.com/r/espressif/idf/tags and # 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 # https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html
# for details. # for details.
idf_ver: ["release-v5.1"] idf_ver: ["release-v5.3"]
idf_target: ["esp32", "esp32s2", "esp32s3", "esp32c2", "esp32c3", "esp32c6", "esp32h2"] idf_target: ["esp32", "esp32s2", "esp32s3", "esp32c2", "esp32c3", "esp32c6", "esp32h2"]
container: espressif/idf:${{ matrix.idf_ver }} container: espressif/idf:${{ matrix.idf_ver }}
steps: steps:
......
tools/esp32-arduino-libs tools/esp32-arduino-libs
tools/xtensa-esp-elf
tools/xtensa-esp32-elf tools/xtensa-esp32-elf
tools/xtensa-esp32s2-elf tools/xtensa-esp32s2-elf
tools/xtensa-esp32s3-elf tools/xtensa-esp32s3-elf
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
# export ARDUINO_SKIP_IDF_VERSION_CHECK=1 # export ARDUINO_SKIP_IDF_VERSION_CHECK=1
# idf.py build # idf.py build
set(min_supported_idf_version "5.1.0") set(min_supported_idf_version "5.3.0")
set(max_supported_idf_version "5.1.99") set(max_supported_idf_version "5.3.99")
set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}") set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}")
if ("${idf_version}" AND NOT "$ENV{ARDUINO_SKIP_IDF_VERSION_CHECK}") if ("${idf_version}" AND NOT "$ENV{ARDUINO_SKIP_IDF_VERSION_CHECK}")
...@@ -293,7 +293,7 @@ endforeach() ...@@ -293,7 +293,7 @@ endforeach()
set(includedirs variants/${CONFIG_ARDUINO_VARIANT}/ cores/esp32/ ${ARDUINO_LIBRARIES_INCLUDEDIRS}) set(includedirs variants/${CONFIG_ARDUINO_VARIANT}/ cores/esp32/ ${ARDUINO_LIBRARIES_INCLUDEDIRS})
set(srcs ${CORE_SRCS} ${ARDUINO_LIBRARIES_SRCS}) set(srcs ${CORE_SRCS} ${ARDUINO_LIBRARIES_SRCS})
set(priv_includes cores/esp32/libb64) 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 espressif__network_provisioning)
set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hid usb esp_psram ${ARDUINO_LIBRARIES_REQUIRES}) 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) if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_OpenThread)
......
...@@ -26,7 +26,9 @@ ...@@ -26,7 +26,9 @@
class Client : public Stream { class Client : public Stream {
public: public:
virtual int connect(IPAddress ip, uint16_t port) = 0; 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) = 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(uint8_t) = 0;
virtual size_t write(const uint8_t *buf, size_t size) = 0; virtual size_t write(const uint8_t *buf, size_t size) = 0;
virtual int available() = 0; virtual int available() = 0;
......
...@@ -286,14 +286,14 @@ bool HWCDC::deinit(void *busptr) { ...@@ -286,14 +286,14 @@ bool HWCDC::deinit(void *busptr) {
running = true; running = true;
// Setting USB D+ D- pins // Setting USB D+ D- pins
bool retCode = true; bool retCode = true;
retCode &= perimanClearPinBus(USB_DM_GPIO_NUM); retCode &= perimanClearPinBus(USB_INT_PHY0_DM_GPIO_NUM);
retCode &= perimanClearPinBus(USB_DP_GPIO_NUM); retCode &= perimanClearPinBus(USB_INT_PHY0_DP_GPIO_NUM);
if (retCode) { if (retCode) {
// Force the host to re-enumerate (BUS_RESET) // Force the host to re-enumerate (BUS_RESET)
pinMode(USB_DM_GPIO_NUM, OUTPUT_OPEN_DRAIN); pinMode(USB_INT_PHY0_DM_GPIO_NUM, OUTPUT_OPEN_DRAIN);
pinMode(USB_DP_GPIO_NUM, OUTPUT_OPEN_DRAIN); pinMode(USB_INT_PHY0_DP_GPIO_NUM, OUTPUT_OPEN_DRAIN);
digitalWrite(USB_DM_GPIO_NUM, LOW); digitalWrite(USB_INT_PHY0_DM_GPIO_NUM, LOW);
digitalWrite(USB_DP_GPIO_NUM, LOW); digitalWrite(USB_INT_PHY0_DP_GPIO_NUM, LOW);
} }
// release the flag // release the flag
running = false; running = false;
...@@ -323,11 +323,11 @@ void HWCDC::begin(unsigned long baud) { ...@@ -323,11 +323,11 @@ void HWCDC::begin(unsigned long baud) {
// delay(10); // USB Host has to enumerate it again // delay(10); // USB Host has to enumerate it again
// Peripheral Manager setting for USB D+ D- pins // 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)) { if (!perimanSetPinBus(pin, ESP32_BUS_TYPE_USB_DM, (void *)this, -1, -1)) {
goto err; 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)) { if (!perimanSetPinBus(pin, ESP32_BUS_TYPE_USB_DP, (void *)this, -1, -1)) {
goto err; goto err;
} }
......
...@@ -26,23 +26,23 @@ ...@@ -26,23 +26,23 @@
void serialEvent(void) __attribute__((weak)); void serialEvent(void) __attribute__((weak));
void serialEvent(void) {} void serialEvent(void) {}
#if SOC_UART_NUM > 1 #if SOC_UART_HP_NUM > 1
void serialEvent1(void) __attribute__((weak)); void serialEvent1(void) __attribute__((weak));
void serialEvent1(void) {} 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) __attribute__((weak));
void serialEvent2(void) {} void serialEvent2(void) {}
#endif /* SOC_UART_NUM > 2 */ #endif /* SOC_UART_HP_NUM > 2 */
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL) #if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
// There is always Seria0 for UART0 // There is always Seria0 for UART0
HardwareSerial Serial0(0); HardwareSerial Serial0(0);
#if SOC_UART_NUM > 1 #if SOC_UART_HP_NUM > 1
HardwareSerial Serial1(1); HardwareSerial Serial1(1);
#endif #endif
#if SOC_UART_NUM > 2 #if SOC_UART_HP_NUM > 2
HardwareSerial Serial2(2); HardwareSerial Serial2(2);
#endif #endif
...@@ -72,12 +72,12 @@ void serialEventRun(void) { ...@@ -72,12 +72,12 @@ void serialEventRun(void) {
if (Serial0.available()) { if (Serial0.available()) {
serialEvent(); serialEvent();
} }
#if SOC_UART_NUM > 1 #if SOC_UART_HP_NUM > 1
if (Serial1.available()) { if (Serial1.available()) {
serialEvent1(); serialEvent1();
} }
#endif #endif
#if SOC_UART_NUM > 2 #if SOC_UART_HP_NUM > 2
if (Serial2.available()) { if (Serial2.available()) {
serialEvent2(); serialEvent2();
} }
...@@ -279,8 +279,8 @@ void HardwareSerial::_uartEventTask(void *args) { ...@@ -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) { 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) { if (_uart_nr >= SOC_UART_HP_NUM) {
log_e("Serial number is invalid, please use a number from 0 to %u", SOC_UART_NUM - 1); log_e("Serial number is invalid, please use a number from 0 to %u", SOC_UART_HP_NUM - 1);
return; return;
} }
...@@ -305,7 +305,7 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in ...@@ -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; txPin = _txPin < 0 ? (int8_t)SOC_TX0 : _txPin;
} }
break; 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: case UART_NUM_1:
if (rxPin < 0 && txPin < 0) { if (rxPin < 0 && txPin < 0) {
// do not change RX1/TX1 if it has already been set before // 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 ...@@ -314,7 +314,7 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
} }
break; break;
#endif #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: case UART_NUM_2:
if (rxPin < 0 && txPin < 0) { if (rxPin < 0 && txPin < 0) {
// do not change RX2/TX2 if it has already been set before // do not change RX2/TX2 if it has already been set before
......
...@@ -146,7 +146,7 @@ typedef enum { ...@@ -146,7 +146,7 @@ typedef enum {
// Default pins for UART1 are arbitrary, and defined here for convenience. // Default pins for UART1 are arbitrary, and defined here for convenience.
#if SOC_UART_NUM > 1 #if SOC_UART_HP_NUM > 1
#ifndef RX1 #ifndef RX1
#if CONFIG_IDF_TARGET_ESP32 #if CONFIG_IDF_TARGET_ESP32
#define RX1 (gpio_num_t)26 #define RX1 (gpio_num_t)26
...@@ -182,11 +182,11 @@ typedef enum { ...@@ -182,11 +182,11 @@ typedef enum {
#define TX1 (gpio_num_t)1 #define TX1 (gpio_num_t)1
#endif #endif
#endif #endif
#endif /* SOC_UART_NUM > 1 */ #endif /* SOC_UART_HP_NUM > 1 */
// Default pins for UART2 are arbitrary, and defined here for convenience. // Default pins for UART2 are arbitrary, and defined here for convenience.
#if SOC_UART_NUM > 2 #if SOC_UART_HP_NUM > 2
#ifndef RX2 #ifndef RX2
#if CONFIG_IDF_TARGET_ESP32 #if CONFIG_IDF_TARGET_ESP32
#define RX2 (gpio_num_t)4 #define RX2 (gpio_num_t)4
...@@ -202,7 +202,7 @@ typedef enum { ...@@ -202,7 +202,7 @@ typedef enum {
#define TX2 (gpio_num_t)20 #define TX2 (gpio_num_t)20
#endif #endif
#endif #endif
#endif /* SOC_UART_NUM > 2 */ #endif /* SOC_UART_HP_NUM > 2 */
typedef std::function<void(void)> OnReceiveCb; typedef std::function<void(void)> OnReceiveCb;
typedef std::function<void(hardwareSerial_error_t)> OnReceiveErrorCb; typedef std::function<void(hardwareSerial_error_t)> OnReceiveErrorCb;
...@@ -357,10 +357,10 @@ extern void serialEventRun(void) __attribute__((weak)); ...@@ -357,10 +357,10 @@ extern void serialEventRun(void) __attribute__((weak));
#endif // ARDUINO_USB_CDC_ON_BOOT #endif // ARDUINO_USB_CDC_ON_BOOT
// There is always Seria0 for UART0 // There is always Seria0 for UART0
extern HardwareSerial Serial0; extern HardwareSerial Serial0;
#if SOC_UART_NUM > 1 #if SOC_UART_HP_NUM > 1
extern HardwareSerial Serial1; extern HardwareSerial Serial1;
#endif #endif
#if SOC_UART_NUM > 2 #if SOC_UART_HP_NUM > 2
extern HardwareSerial Serial2; extern HardwareSerial Serial2;
#endif #endif
#endif //!defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL) #endif //!defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
#define I2C_SLAVE_USE_RX_QUEUE 0 // 1: Queue, 0: RingBuffer #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_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)) #define I2C_SDA_IDX(p) ((p == 0) ? I2CEXT0_SDA_OUT_IDX : ((p == 1) ? I2CEXT1_SDA_OUT_IDX : 0))
#else #else
...@@ -99,14 +99,14 @@ typedef union { ...@@ -99,14 +99,14 @@ typedef union {
uint32_t val; uint32_t val;
} i2c_slave_queue_event_t; } 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 {&I2C0, 0, -1, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0
#if !CONFIG_DISABLE_HAL_LOCKS #if !CONFIG_DISABLE_HAL_LOCKS
, ,
NULL NULL
#endif #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 {&I2C1, 1, -1, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0
#if !CONFIG_DISABLE_HAL_LOCKS #if !CONFIG_DISABLE_HAL_LOCKS
, ,
...@@ -210,7 +210,7 @@ static bool i2cSlaveDetachBus(void *bus_i2c_num); ...@@ -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) { 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); log_e("Invalid port num: %u", num);
return ESP_ERR_INVALID_ARG; return ESP_ERR_INVALID_ARG;
} }
...@@ -224,7 +224,7 @@ esp_err_t i2cSlaveAttachCallbacks(uint8_t num, i2c_slave_request_cb_t request_ca ...@@ -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) { 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); log_e("Invalid port num: %u", num);
return ESP_ERR_INVALID_ARG; 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 ...@@ -309,14 +309,14 @@ esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t
if (i2c->num == 0) { if (i2c->num == 0) {
periph_ll_enable_clk_clear_rst(PERIPH_I2C0_MODULE); periph_ll_enable_clk_clear_rst(PERIPH_I2C0_MODULE);
#if SOC_I2C_NUM > 1 #if SOC_HP_I2C_NUM > 1
} else { } else {
periph_ll_enable_clk_clear_rst(PERIPH_I2C1_MODULE); periph_ll_enable_clk_clear_rst(PERIPH_I2C1_MODULE);
#endif #endif
} }
i2c_ll_slave_init(i2c->dev); i2c_ll_slave_init(i2c->dev);
i2c_ll_set_fifo_mode(i2c->dev, true); i2c_ll_slave_set_fifo_mode(i2c->dev, true);
i2c_ll_set_slave_addr(i2c->dev, slaveID, false); i2c_ll_set_slave_addr(i2c->dev, slaveID, false);
i2c_ll_set_tout(i2c->dev, I2C_LL_MAX_TIMEOUT); i2c_ll_set_tout(i2c->dev, I2C_LL_MAX_TIMEOUT);
i2c_slave_set_frequency(i2c, frequency); 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 ...@@ -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_disable_intr_mask(i2c->dev, I2C_LL_INTR_MASK);
i2c_ll_clear_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_slave_set_fifo_mode(i2c->dev, true);
if (!i2c->intr_handle) { if (!i2c->intr_handle) {
uint32_t flags = ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_SHARED; uint32_t flags = ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_SHARED;
if (i2c->num == 0) { if (i2c->num == 0) {
ret = esp_intr_alloc(ETS_I2C_EXT0_INTR_SOURCE, flags, &i2c_slave_isr_handler, i2c, &i2c->intr_handle); 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 { } else {
ret = esp_intr_alloc(ETS_I2C_EXT1_INTR_SOURCE, flags, &i2c_slave_isr_handler, i2c, &i2c->intr_handle); ret = esp_intr_alloc(ETS_I2C_EXT1_INTR_SOURCE, flags, &i2c_slave_isr_handler, i2c, &i2c->intr_handle);
#endif #endif
...@@ -375,7 +375,7 @@ fail: ...@@ -375,7 +375,7 @@ fail:
} }
esp_err_t i2cSlaveDeinit(uint8_t num) { 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); log_e("Invalid port num: %u", num);
return ESP_ERR_INVALID_ARG; return ESP_ERR_INVALID_ARG;
} }
...@@ -398,7 +398,7 @@ esp_err_t i2cSlaveDeinit(uint8_t num) { ...@@ -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) { 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); log_e("Invalid port num: %u", num);
return 0; return 0;
} }
...@@ -515,16 +515,16 @@ static bool i2c_slave_set_frequency(i2c_slave_struct_t *i2c, uint32_t clk_speed) ...@@ -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; i2c_hal_clk_config_t clk_cal;
#if SOC_I2C_SUPPORT_APB #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*/ i2c_ll_set_source_clk(i2c->dev, SOC_MOD_CLK_APB); /*!< I2C source clock from APB, 80M*/
#elif SOC_I2C_SUPPORT_XTAL #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 */ i2c_ll_set_source_clk(i2c->dev, SOC_MOD_CLK_XTAL); /*!< I2C source clock from XTAL, 40M */
#endif #endif
i2c_ll_set_txfifo_empty_thr(i2c->dev, a); 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_rxfifo_full_thr(i2c->dev, SOC_I2C_FIFO_LEN - a);
i2c_ll_set_bus_timing(i2c->dev, &clk_cal); i2c_ll_master_set_bus_timing(i2c->dev, &clk_cal);
i2c_ll_set_filter(i2c->dev, 3); i2c_ll_master_set_filter(i2c->dev, 3);
return true; return true;
} }
......
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
Internal Private Touch Data Structure and Functions 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 __touchSleepCycles = 0x1000;
static uint16_t __touchMeasureCycles = 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 __touchSleepCycles = TOUCH_PAD_SLEEP_CYCLE_DEFAULT;
static uint16_t __touchMeasureCycles = TOUCH_PAD_MEASURE_CYCLE_DEFAULT; static uint16_t __touchMeasureCycles = TOUCH_PAD_MEASURE_CYCLE_DEFAULT;
#endif #endif
...@@ -37,7 +37,7 @@ typedef struct { ...@@ -37,7 +37,7 @@ typedef struct {
voidFuncPtr fn; voidFuncPtr fn;
bool callWithArgs; bool callWithArgs;
void *arg; 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; bool lastStatusIsPressed;
#endif #endif
} TouchInterruptHandle_t; } TouchInterruptHandle_t;
...@@ -51,7 +51,7 @@ static bool initialized = false; ...@@ -51,7 +51,7 @@ static bool initialized = false;
static bool channels_initialized[SOC_TOUCH_SENSOR_NUM] = {false}; static bool channels_initialized[SOC_TOUCH_SENSOR_NUM] = {false};
static void ARDUINO_ISR_ATTR __touchISR(void *arg) { 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(); uint32_t pad_intr = touch_pad_get_status();
//clear interrupt //clear interrupt
touch_pad_clear_status(); touch_pad_clear_status();
...@@ -68,7 +68,7 @@ static void ARDUINO_ISR_ATTR __touchISR(void *arg) { ...@@ -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(); touch_pad_intr_mask_t evt = touch_pad_read_intr_status_mask();
uint8_t pad_num = touch_pad_get_current_meas_channel(); uint8_t pad_num = touch_pad_get_current_meas_channel();
if (evt & TOUCH_PAD_INTR_MASK_ACTIVE) { if (evt & TOUCH_PAD_INTR_MASK_ACTIVE) {
...@@ -93,9 +93,9 @@ static void ARDUINO_ISR_ATTR __touchISR(void *arg) { ...@@ -93,9 +93,9 @@ static void ARDUINO_ISR_ATTR __touchISR(void *arg) {
static void __touchSetCycles(uint16_t measure, uint16_t sleep) { static void __touchSetCycles(uint16_t measure, uint16_t sleep) {
__touchSleepCycles = sleep; __touchSleepCycles = sleep;
__touchMeasureCycles = measure; __touchMeasureCycles = measure;
#if SOC_TOUCH_VERSION_1 // ESP32 #if SOC_TOUCH_SENSOR_VERSION == 1 // ESP32
touch_pad_set_measurement_clock_cycles(measure); 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); touch_pad_set_charge_discharge_times(measure);
#endif #endif
touch_pad_set_measurement_interval(sleep); touch_pad_set_measurement_interval(sleep);
...@@ -123,7 +123,7 @@ static void __touchInit() { ...@@ -123,7 +123,7 @@ static void __touchInit() {
esp_err_t err = ESP_OK; esp_err_t err = ESP_OK;
#if SOC_TOUCH_VERSION_1 // ESP32 #if SOC_TOUCH_SENSOR_VERSION == 1 // ESP32
err = touch_pad_init(); err = touch_pad_init();
if (err != ESP_OK) { if (err != ESP_OK) {
goto err; goto err;
...@@ -143,8 +143,8 @@ static void __touchInit() { ...@@ -143,8 +143,8 @@ static void __touchInit() {
if (err != ESP_OK) { if (err != ESP_OK) {
goto err; goto err;
} }
touch_pad_intr_enable(); // returns ESP_OK 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(); err = touch_pad_init();
if (err != ESP_OK) { if (err != ESP_OK) {
goto err; goto err;
...@@ -179,11 +179,11 @@ static void __touchChannelInit(int pad) { ...@@ -179,11 +179,11 @@ static void __touchChannelInit(int pad) {
return; return;
} }
#if SOC_TOUCH_VERSION_1 // ESP32 #if SOC_TOUCH_SENSOR_VERSION == 1 // ESP32
// Initial no Threshold and setup // Initial no Threshold and setup
__touchInterruptHandlers[pad].fn = NULL; __touchInterruptHandlers[pad].fn = NULL;
touch_pad_config(pad, SOC_TOUCH_PAD_THRESHOLD_MAX); // returns ESP_OK touch_pad_config(pad, TOUCH_PAD_THRESHOLD_MAX); // returns ESP_OK
#elif SOC_TOUCH_VERSION_2 // ESP32S2, ESP32S3 #elif SOC_TOUCH_SENSOR_VERSION == 2 // ESP32S2, ESP32S3
// Initial no Threshold and setup // Initial no Threshold and setup
__touchInterruptHandlers[pad].fn = NULL; __touchInterruptHandlers[pad].fn = NULL;
touch_pad_config(pad); // returns ESP_OK touch_pad_config(pad); // returns ESP_OK
...@@ -238,7 +238,7 @@ static void __touchConfigInterrupt(uint8_t pin, void (*userFunc)(void), void *Ar ...@@ -238,7 +238,7 @@ static void __touchConfigInterrupt(uint8_t pin, void (*userFunc)(void), void *Ar
if (userFunc == NULL) { if (userFunc == NULL) {
// detach ISR User Call // detach ISR User Call
__touchInterruptHandlers[pad].fn = NULL; __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 { } else {
// attach ISR User Call // attach ISR User Call
__touchInit(); __touchInit();
...@@ -270,7 +270,7 @@ static void __touchDettachInterrupt(uint8_t pin) { ...@@ -270,7 +270,7 @@ static void __touchDettachInterrupt(uint8_t pin) {
External Public Touch API Functions 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) { void touchInterruptSetThresholdDirection(bool mustbeLower) {
if (mustbeLower) { if (mustbeLower) {
touch_pad_set_trigger_mode(TOUCH_TRIGGER_BELOW); touch_pad_set_trigger_mode(TOUCH_TRIGGER_BELOW);
...@@ -278,7 +278,7 @@ void touchInterruptSetThresholdDirection(bool mustbeLower) { ...@@ -278,7 +278,7 @@ void touchInterruptSetThresholdDirection(bool mustbeLower) {
touch_pad_set_trigger_mode(TOUCH_TRIGGER_ABOVE); 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 // returns true if touch pad has been and continues pressed and false otherwise
bool touchInterruptGetLastStatus(uint8_t pin) { bool touchInterruptGetLastStatus(uint8_t pin) {
int8_t pad = digitalPinToTouchChannel(pin); int8_t pad = digitalPinToTouchChannel(pin);
...@@ -307,10 +307,10 @@ void touchSleepWakeUpEnable(uint8_t pin, touch_value_t threshold) { ...@@ -307,10 +307,10 @@ void touchSleepWakeUpEnable(uint8_t pin, touch_value_t threshold) {
return; 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); 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_channel_enable(pad, true);
touch_pad_sleep_set_threshold(pad, threshold); touch_pad_sleep_set_threshold(pad, threshold);
......
...@@ -29,13 +29,13 @@ extern "C" { ...@@ -29,13 +29,13 @@ extern "C" {
#include "esp32-hal.h" #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! #error Touch IDF driver Not supported!
#endif #endif
#if SOC_TOUCH_VERSION_1 // ESP32 #if SOC_TOUCH_SENSOR_VERSION == 1 // ESP32
typedef uint16_t touch_value_t; 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; typedef uint32_t touch_value_t;
#endif #endif
...@@ -71,7 +71,7 @@ void touchDetachInterrupt(uint8_t pin); ...@@ -71,7 +71,7 @@ void touchDetachInterrupt(uint8_t pin);
* Default if Lower. * 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); void touchInterruptSetThresholdDirection(bool mustbeLower);
#endif #endif
...@@ -83,7 +83,7 @@ void touchInterruptSetThresholdDirection(bool mustbeLower); ...@@ -83,7 +83,7 @@ void touchInterruptSetThresholdDirection(bool mustbeLower);
* as soon as the touchpad is touched and/or released * 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 // returns true if touch pad has been and continues pressed and false otherwise
bool touchInterruptGetLastStatus(uint8_t pin); bool touchInterruptGetLastStatus(uint8_t pin);
#endif #endif
......
...@@ -61,10 +61,10 @@ struct uart_struct_t { ...@@ -61,10 +61,10 @@ struct uart_struct_t {
static uart_t _uart_bus_array[] = { static uart_t _uart_bus_array[] = {
{0, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, {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}, {1, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0},
#endif #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}, {2, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0},
#endif #endif
}; };
...@@ -81,10 +81,10 @@ static uart_t _uart_bus_array[] = { ...@@ -81,10 +81,10 @@ static uart_t _uart_bus_array[] = {
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}, {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}, {NULL, 1, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0},
#endif #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}, {NULL, 2, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0},
#endif #endif
}; };
...@@ -94,8 +94,8 @@ static uart_t _uart_bus_array[] = { ...@@ -94,8 +94,8 @@ static uart_t _uart_bus_array[] = {
// Negative Pin Number will keep it unmodified, thus this function can detach individual pins // 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 // 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) { 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) { if (uart_num >= SOC_UART_HP_NUM) {
log_e("Serial number is invalid, please use number from 0 to %u", SOC_UART_NUM - 1); log_e("Serial number is invalid, please use number from 0 to %u", SOC_UART_HP_NUM - 1);
return false; return false;
} }
// get UART information // get UART information
...@@ -181,8 +181,8 @@ static bool _uartDetachBus_RTS(void *busptr) { ...@@ -181,8 +181,8 @@ static bool _uartDetachBus_RTS(void *busptr) {
// Attach function for UART // Attach function for UART
// connects the IO Pad, set Paripheral Manager and internal UART structure data // 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) { 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) { if (uart_num >= SOC_UART_HP_NUM) {
log_e("Serial number is invalid, please use number from 0 to %u", SOC_UART_NUM - 1); log_e("Serial number is invalid, please use number from 0 to %u", SOC_UART_HP_NUM - 1);
return false; return false;
} }
// get UART information // get UART information
...@@ -308,8 +308,8 @@ bool uartIsDriverInstalled(uart_t *uart) { ...@@ -308,8 +308,8 @@ bool uartIsDriverInstalled(uart_t *uart) {
// Negative Pin Number will keep it unmodified, thus this function can set individual pins // Negative Pin Number will keep it unmodified, thus this function can set individual pins
// When pins are changed, it will detach the previous one // 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) { bool uartSetPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin) {
if (uart_num >= SOC_UART_NUM) { if (uart_num >= SOC_UART_HP_NUM) {
log_e("Serial number is invalid, please use number from 0 to %u", SOC_UART_NUM - 1); log_e("Serial number is invalid, please use number from 0 to %u", SOC_UART_HP_NUM - 1);
return false; return false;
} }
// get UART information // get UART information
...@@ -378,7 +378,7 @@ bool _testUartBegin( ...@@ -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 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 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 return false; // no new driver has to be installed
} }
uart_t *uart = &_uart_bus_array[uart_nr]; uart_t *uart = &_uart_bus_array[uart_nr];
...@@ -400,8 +400,8 @@ uart_t *uartBegin( ...@@ -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 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 uint8_t rxfifo_full_thrhd
) { ) {
if (uart_nr >= SOC_UART_NUM) { if (uart_nr >= SOC_UART_HP_NUM) {
log_e("UART number is invalid, please use number from 0 to %u", SOC_UART_NUM - 1); 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 return NULL; // no new driver was installed
} }
uart_t *uart = &_uart_bus_array[uart_nr]; uart_t *uart = &_uart_bus_array[uart_nr];
...@@ -604,8 +604,8 @@ bool uartSetRxFIFOFull(uart_t *uart, uint8_t numBytesFIFOFull) { ...@@ -604,8 +604,8 @@ bool uartSetRxFIFOFull(uart_t *uart, uint8_t numBytesFIFOFull) {
} }
void uartEnd(uint8_t uart_num) { void uartEnd(uint8_t uart_num) {
if (uart_num >= SOC_UART_NUM) { if (uart_num >= SOC_UART_HP_NUM) {
log_e("Serial number is invalid, please use number from 0 to %u", SOC_UART_NUM - 1); log_e("Serial number is invalid, please use number from 0 to %u", SOC_UART_HP_NUM - 1);
return; return;
} }
// get UART information // get UART information
...@@ -819,14 +819,14 @@ static void ARDUINO_ISR_ATTR uart0_write_char(char c) { ...@@ -819,14 +819,14 @@ static void ARDUINO_ISR_ATTR uart0_write_char(char c) {
uart_ll_write_txfifo(&UART0, (const uint8_t *)&c, 1); 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) { static void ARDUINO_ISR_ATTR uart1_write_char(char c) {
while (uart_ll_get_txfifo_len(&UART1) == 0); while (uart_ll_get_txfifo_len(&UART1) == 0);
uart_ll_write_txfifo(&UART1, (const uint8_t *)&c, 1); uart_ll_write_txfifo(&UART1, (const uint8_t *)&c, 1);
} }
#endif #endif
#if SOC_UART_NUM > 2 #if SOC_UART_HP_NUM > 2
static void ARDUINO_ISR_ATTR uart2_write_char(char c) { static void ARDUINO_ISR_ATTR uart2_write_char(char c) {
while (uart_ll_get_txfifo_len(&UART2) == 0); while (uart_ll_get_txfifo_len(&UART2) == 0);
uart_ll_write_txfifo(&UART2, (const uint8_t *)&c, 1); uart_ll_write_txfifo(&UART2, (const uint8_t *)&c, 1);
...@@ -836,10 +836,10 @@ static void ARDUINO_ISR_ATTR uart2_write_char(char c) { ...@@ -836,10 +836,10 @@ static void ARDUINO_ISR_ATTR uart2_write_char(char c) {
void uart_install_putc() { void uart_install_putc() {
switch (s_uart_debug_nr) { switch (s_uart_debug_nr) {
case 0: ets_install_putc1((void (*)(char)) & uart0_write_char); break; 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; case 1: ets_install_putc1((void (*)(char)) & uart1_write_char); break;
#endif #endif
#if SOC_UART_NUM > 2 #if SOC_UART_HP_NUM > 2
case 2: ets_install_putc1((void (*)(char)) & uart2_write_char); break; case 2: ets_install_putc1((void (*)(char)) & uart2_write_char); break;
#endif #endif
default: ets_install_putc1(NULL); break; default: ets_install_putc1(NULL); break;
...@@ -850,7 +850,7 @@ void uart_install_putc() { ...@@ -850,7 +850,7 @@ void uart_install_putc() {
// Routines that take care of UART mode in the HardwareSerial Class code // 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 // used to set UART_MODE_RS485_HALF_DUPLEX auto RTS for TXD for ESP32 chips
bool uartSetMode(uart_t *uart, uart_mode_t mode) { 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; return false;
} }
...@@ -861,7 +861,7 @@ bool uartSetMode(uart_t *uart, uart_mode_t mode) { ...@@ -861,7 +861,7 @@ bool uartSetMode(uart_t *uart, uart_mode_t mode) {
} }
void uartSetDebug(uart_t *uart) { 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; s_uart_debug_nr = -1;
} else { } else {
s_uart_debug_nr = uart->num; s_uart_debug_nr = uart->num;
...@@ -1103,7 +1103,7 @@ unsigned long uartDetectBaudrate(uart_t *uart) { ...@@ -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 // 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_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)) #define UART_RX_SIGNAL(uartNumber) (uartNumber == UART_NUM_0 ? U0RXD_IN_IDX : (uartNumber == UART_NUM_1 ? U1RXD_IN_IDX : U2RXD_IN_IDX))
#else #else
...@@ -1115,7 +1115,7 @@ unsigned long uartDetectBaudrate(uart_t *uart) { ...@@ -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. 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) { 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; return;
} }
esp_rom_gpio_connect_out_signal(rxPin, UART_TX_SIGNAL(uartNum), false, false); esp_rom_gpio_connect_out_signal(rxPin, UART_TX_SIGNAL(uartNum), false, false);
......
...@@ -42,7 +42,7 @@ files: ...@@ -42,7 +42,7 @@ files:
- "platform.txt" - "platform.txt"
- "programmers.txt" - "programmers.txt"
dependencies: dependencies:
idf: ">=5.1,<5.2" idf: ">=5.3,<5.4"
# mdns 1.2.1 is necessary to build H2 with no WiFi # mdns 1.2.1 is necessary to build H2 with no WiFi
espressif/mdns: espressif/mdns:
version: "^1.2.3" version: "^1.2.3"
......
...@@ -17,12 +17,6 @@ ...@@ -17,12 +17,6 @@
#error Serial Port Profile for Bluetooth is not available or not enabled. It is only available for the ESP32 chip. #error Serial Port Profile for Bluetooth is not available or not enabled. It is only available for the ESP32 chip.
#endif #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"; const char *deviceName = "ESP32_Legacy_example";
BluetoothSerial SerialBT; BluetoothSerial SerialBT;
...@@ -62,4 +56,3 @@ void loop() { ...@@ -62,4 +56,3 @@ void loop() {
delay(1); // Feed the watchdog delay(1); // Feed the watchdog
} }
} }
#endif
...@@ -22,11 +22,6 @@ ...@@ -22,11 +22,6 @@
#error Serial Port Profile for Bluetooth is not available or not enabled. It is only available for the ESP32 chip. #error Serial Port Profile for Bluetooth is not available or not enabled. It is only available for the ESP32 chip.
#endif #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"; const char *deviceName = "ESP32_SSP_example";
// The following lines defines the method of pairing // The following lines defines the method of pairing
......
...@@ -71,11 +71,9 @@ static esp_bd_addr_t _peer_bd_addr; ...@@ -71,11 +71,9 @@ static esp_bd_addr_t _peer_bd_addr;
static char _remote_name[ESP_BT_GAP_MAX_BDNAME_LEN + 1]; static char _remote_name[ESP_BT_GAP_MAX_BDNAME_LEN + 1];
static bool _isRemoteAddressSet; static bool _isRemoteAddressSet;
static bool _isMaster; static bool _isMaster;
#ifdef CONFIG_BT_SSP_ENABLED
static bool _enableSSP; static bool _enableSSP;
static bool _IO_CAP_INPUT; static bool _IO_CAP_INPUT;
static bool _IO_CAP_OUTPUT; static bool _IO_CAP_OUTPUT;
#endif
esp_bt_pin_code_t _pin_code = {0}; 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 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; 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 ...@@ -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); esp_bt_gap_pin_reply(param->pin_req.bda, true, _pin_code_len, _pin_code);
} }
break; break;
#ifdef CONFIG_BT_SSP_ENABLED
case ESP_BT_GAP_CFM_REQ_EVT: // Enum 6 - Security Simple Pairing User Confirmation request. 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); log_i("ESP_BT_GAP_CFM_REQ_EVT Please compare the numeric value: %d", param->cfm_req.num_val);
if (confirm_request_callback) { 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 ...@@ -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); esp_bt_gap_ssp_confirm_reply(param->cfm_req.bda, false);
} }
break; break;
#endif
case ESP_BT_GAP_KEY_NOTIF_EVT: // Enum 7 - Security Simple Pairing Passkey Notification 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); log_i("ESP_BT_GAP_KEY_NOTIF_EVT passkey:%d", param->key_notif.passkey);
break; break;
#ifdef CONFIG_BT_SSP_ENABLED
case ESP_BT_GAP_KEY_REQ_EVT: // Enum 8 - Security Simple Pairing Passkey request 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!"); log_i("ESP_BT_GAP_KEY_REQ_EVT Please enter passkey!");
if (key_request_callback) { 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 ...@@ -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); esp_bt_gap_ssp_confirm_reply(param->cfm_req.bda, false);
} }
break; break;
#endif
case ESP_BT_GAP_READ_RSSI_DELTA_EVT: // Enum 9 - Read rssi event 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"); 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) { ...@@ -707,7 +700,6 @@ static bool _init_bt(const char *deviceName, bt_mode mode) {
log_i("device name set"); log_i("device name set");
esp_bt_dev_set_device_name(deviceName); esp_bt_dev_set_device_name(deviceName);
#ifdef CONFIG_BT_SSP_ENABLED
if (_enableSSP) { if (_enableSSP) {
log_i("Simple Secure Pairing"); log_i("Simple Secure Pairing");
esp_bt_sp_param_t param_type = ESP_BT_SP_IOCAP_MODE; 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) { ...@@ -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)); 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 // the default BTA_DM_COD_LOUDSPEAKER does not work with the macOS BT stack
esp_bt_cod_t cod; esp_bt_cod_t cod;
...@@ -894,7 +885,6 @@ void BluetoothSerial::memrelease() { ...@@ -894,7 +885,6 @@ void BluetoothSerial::memrelease() {
esp_bt_mem_release(ESP_BT_MODE_BTDM); esp_bt_mem_release(ESP_BT_MODE_BTDM);
} }
#ifdef CONFIG_BT_SSP_ENABLED
void BluetoothSerial::onConfirmRequest(ConfirmRequestCb cb) { void BluetoothSerial::onConfirmRequest(ConfirmRequestCb cb) {
confirm_request_callback = cb; confirm_request_callback = cb;
} }
...@@ -906,7 +896,6 @@ void BluetoothSerial::onKeyRequest(KeyRequestCb cb) { ...@@ -906,7 +896,6 @@ void BluetoothSerial::onKeyRequest(KeyRequestCb cb) {
void BluetoothSerial::respondPasskey(uint32_t passkey) { void BluetoothSerial::respondPasskey(uint32_t passkey) {
esp_bt_gap_ssp_passkey_reply(current_bd_addr, true, passkey); esp_bt_gap_ssp_passkey_reply(current_bd_addr, true, passkey);
} }
#endif
void BluetoothSerial::onAuthComplete(AuthCompleteCb cb) { void BluetoothSerial::onAuthComplete(AuthCompleteCb cb) {
auth_complete_callback = cb; auth_complete_callback = cb;
...@@ -921,7 +910,6 @@ esp_err_t BluetoothSerial::register_callback(esp_spp_cb_t callback) { ...@@ -921,7 +910,6 @@ esp_err_t BluetoothSerial::register_callback(esp_spp_cb_t callback) {
return ESP_OK; return ESP_OK;
} }
#ifdef CONFIG_BT_SSP_ENABLED
// Enable Simple Secure Pairing (using generated PIN) // Enable Simple Secure Pairing (using generated PIN)
// This must be called before calling begin, otherwise has no effect! // This must be called before calling begin, otherwise has no effect!
void BluetoothSerial::enableSSP() { void BluetoothSerial::enableSSP() {
...@@ -957,8 +945,6 @@ void BluetoothSerial::disableSSP() { ...@@ -957,8 +945,6 @@ void BluetoothSerial::disableSSP() {
_enableSSP = false; _enableSSP = false;
} }
#else
bool BluetoothSerial::setPin(const char *pin, uint8_t pin_code_len) { bool BluetoothSerial::setPin(const char *pin, uint8_t pin_code_len) {
if (pin_code_len == 0 || pin_code_len > 16) { 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); 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) { ...@@ -968,7 +954,6 @@ bool BluetoothSerial::setPin(const char *pin, uint8_t pin_code_len) {
memcpy(_pin_code, pin, 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); 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 BluetoothSerial::connect(String remoteName) {
bool retval = false; bool retval = false;
......
...@@ -56,21 +56,16 @@ public: ...@@ -56,21 +56,16 @@ public:
void onData(BluetoothSerialDataCb cb); void onData(BluetoothSerialDataCb cb);
esp_err_t register_callback(esp_spp_cb_t callback); esp_err_t register_callback(esp_spp_cb_t callback);
#ifdef CONFIG_BT_SSP_ENABLED
void onConfirmRequest(ConfirmRequestCb cb); void onConfirmRequest(ConfirmRequestCb cb);
void onKeyRequest(KeyRequestCb cb); void onKeyRequest(KeyRequestCb cb);
void respondPasskey(uint32_t passkey); void respondPasskey(uint32_t passkey);
#endif
void onAuthComplete(AuthCompleteCb cb); void onAuthComplete(AuthCompleteCb cb);
void confirmReply(boolean confirm); void confirmReply(boolean confirm);
#ifdef CONFIG_BT_SSP_ENABLED
void enableSSP(); void enableSSP();
void enableSSP(bool inputCapability, bool outputCapability); void enableSSP(bool inputCapability, bool outputCapability);
void disableSSP(); void disableSSP();
#else
bool setPin(const char *pin, uint8_t pin_code_len); bool setPin(const char *pin, uint8_t pin_code_len);
#endif
bool connect(String remoteName); bool connect(String remoteName);
bool connect( bool connect(
uint8_t remoteAddress[], int channel = 0, esp_spp_sec_t sec_mask = (ESP_SPP_SEC_ENCRYPT | ESP_SPP_SEC_AUTHENTICATE), uint8_t remoteAddress[], int channel = 0, esp_spp_sec_t sec_mask = (ESP_SPP_SEC_ENCRYPT | ESP_SPP_SEC_AUTHENTICATE),
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
*/ */
// soc/soc_caps.h has information about each SoC target // 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 // depending on the number of available UARTs in the ESP32xx
// This makes the code transparent to what SoC is used. // This makes the code transparent to what SoC is used.
#include "soc/soc_caps.h" #include "soc/soc_caps.h"
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
#define TXPIN 5 // GPIO 5 => TX for Serial1 or Serial2 #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) // 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; HardwareSerial &testingSerial = Serial1;
#elif SOC_UART_NUM > 2 && TEST_UART == 2 #elif SOC_UART_HP_NUM > 2 && TEST_UART == 2
HardwareSerial &testingSerial = Serial2; HardwareSerial &testingSerial = Serial2;
#endif #endif
...@@ -36,11 +36,11 @@ void processOnReceiving(HardwareSerial &mySerial) { ...@@ -36,11 +36,11 @@ void processOnReceiving(HardwareSerial &mySerial) {
int8_t uart_num = -1; int8_t uart_num = -1;
if (&mySerial == &Serial0) { if (&mySerial == &Serial0) {
uart_num = 0; uart_num = 0;
#if SOC_UART_NUM > 1 #if SOC_UART_HP_NUM > 1
} else if (&mySerial == &Serial1) { } else if (&mySerial == &Serial1) {
uart_num = 1; uart_num = 1;
#endif #endif
#if SOC_UART_NUM > 2 #if SOC_UART_HP_NUM > 2
} else if (&mySerial == &Serial2) { } else if (&mySerial == &Serial2) {
uart_num = 2; uart_num = 2;
#endif #endif
......
...@@ -819,7 +819,7 @@ size_t I2SClass::readBytes(char *buffer, size_t size) { ...@@ -819,7 +819,7 @@ size_t I2SClass::readBytes(char *buffer, size_t size) {
return total_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 written = 0;
size_t bytes_sent = 0; size_t bytes_sent = 0;
last_error = ESP_FAIL; last_error = ESP_FAIL;
......
...@@ -62,7 +62,7 @@ public: ...@@ -62,7 +62,7 @@ public:
bool end(); bool end();
size_t readBytes(char *buffer, size_t size); 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(); i2s_chan_handle_t txChan();
uint32_t txSampleRate(); uint32_t txSampleRate();
......
...@@ -170,6 +170,11 @@ bool ETHClass::begin(eth_phy_type_t type, int32_t phy_addr, int mdc, int mdio, i ...@@ -170,6 +170,11 @@ bool ETHClass::begin(eth_phy_type_t type, int32_t phy_addr, int mdc, int mdio, i
Network.begin(); Network.begin();
_ethernets[_eth_index] = this; _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(); 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_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 mac_config.clock_config.rmii.clock_gpio = (1 == clock_mode) ? EMAC_APPL_CLK_OUT_GPIO
......
...@@ -36,7 +36,8 @@ static void smoke_test() { ...@@ -36,7 +36,8 @@ static void smoke_test() {
Insights.event(TAG, "[count][%d]", count); Insights.event(TAG, "[count][%d]", count);
} else { } else {
log_e("[count][%d] [crash_count][%" PRIu32 "] [excvaddr][0x0f] Crashing...", count, s_reset_count); 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;
} }
} }
......
...@@ -28,8 +28,6 @@ class NetworkClientRxBuffer; ...@@ -28,8 +28,6 @@ class NetworkClientRxBuffer;
class ESPLwIPClient : public Client { class ESPLwIPClient : public Client {
public: 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; virtual void setConnectionTimeout(uint32_t milliseconds) = 0;
}; };
......
...@@ -279,7 +279,7 @@ bool PPPClass::begin(ppp_modem_model_t model, uint8_t uart_num, int baud_rate) { ...@@ -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.flow_control = _flow_ctrl;
dte_config.uart_config.rx_buffer_size = _rx_buffer_size; dte_config.uart_config.rx_buffer_size = _rx_buffer_size;
dte_config.uart_config.tx_buffer_size = _tx_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; dte_config.uart_config.baud_rate = baud_rate;
/* Configure the DCE */ /* Configure the DCE */
......
This diff is collapsed.
...@@ -3,9 +3,7 @@ version=3.0.4 ...@@ -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={runtime.platform.path}/tools/esp32-arduino-libs
tools.esp32-arduino-libs.path.windows={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-esp-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp-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-gdb.path={runtime.platform.path}/tools/xtensa-esp-elf-gdb 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-gcc.path={runtime.platform.path}/tools/riscv32-esp-elf
tools.riscv32-esp-elf-gdb.path={runtime.platform.path}/tools/riscv32-esp-elf-gdb 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 ...@@ -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=python3 "{runtime.platform.path}"/tools/gen_insights_package.py
tools.gen_insights_pkg.cmd.windows="{runtime.platform.path}\tools\gen_insights_package.exe" 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.prefix={build.tarch}-{build.target}-elf-
compiler.sdk.path={tools.esp32-arduino-libs.path}/{build.mcu} compiler.sdk.path={tools.esp32-arduino-libs.path}/{build.mcu}
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
* *
*/ */
#if SOC_UART_NUM == 2 #if SOC_UART_HP_NUM == 2
// Used for the pin swap test // Used for the pin swap test
#define NEW_RX1 9 #define NEW_RX1 9
#define NEW_TX1 10 #define NEW_TX1 10
...@@ -64,14 +64,14 @@ extern int8_t uart_get_TxPin(uint8_t uart_num); ...@@ -64,14 +64,14 @@ extern int8_t uart_get_TxPin(uint8_t uart_num);
// This function starts all the available test UARTs // This function starts all the available test UARTs
void start_serial(unsigned long baudrate = 115200) { void start_serial(unsigned long baudrate = 115200) {
#if SOC_UART_NUM >= 2 #if SOC_UART_HP_NUM >= 2
Serial1.begin(baudrate); Serial1.begin(baudrate);
while (!Serial1) { while (!Serial1) {
delay(10); delay(10);
} }
#endif #endif
#if SOC_UART_NUM >= 3 #if SOC_UART_HP_NUM >= 3
Serial2.begin(baudrate); Serial2.begin(baudrate);
while (!Serial2) { while (!Serial2) {
delay(10); delay(10);
...@@ -81,11 +81,11 @@ void start_serial(unsigned long baudrate = 115200) { ...@@ -81,11 +81,11 @@ void start_serial(unsigned long baudrate = 115200) {
// This function stops all the available test UARTs // This function stops all the available test UARTs
void stop_serial(bool hard_stop = false) { void stop_serial(bool hard_stop = false) {
#if SOC_UART_NUM >= 2 #if SOC_UART_HP_NUM >= 2
Serial1.end(/*hard_stop*/); Serial1.end(/*hard_stop*/);
#endif #endif
#if SOC_UART_NUM >= 3 #if SOC_UART_HP_NUM >= 3
Serial2.end(/*hard_stop*/); Serial2.end(/*hard_stop*/);
#endif #endif
} }
...@@ -93,14 +93,14 @@ void stop_serial(bool hard_stop = false) { ...@@ -93,14 +93,14 @@ void stop_serial(bool hard_stop = false) {
// This function transmits a message and checks if it was received correctly // 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) { void transmit_and_check_msg(const String msg_append, bool perform_assert = true) {
delay(100); // Wait for some settings changes to take effect 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.print("Hello from Serial1 (UART1) >>> via loopback >>> Serial1 (UART1) " + msg_append);
Serial1.flush(); Serial1.flush();
delay(100); delay(100);
if (perform_assert) { if (perform_assert) {
TEST_ASSERT_EQUAL_STRING(("Hello from Serial1 (UART1) >>> via loopback >>> Serial1 (UART1) " + msg_append).c_str(), recv_msg.c_str()); 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.print("Hello from Serial1 (UART1) >>> to >>> Serial2 (UART2) " + msg_append);
Serial1.flush(); Serial1.flush();
delay(100); delay(100);
...@@ -126,9 +126,9 @@ void transmit_and_check_msg(const String msg_append, bool perform_assert = true) ...@@ -126,9 +126,9 @@ void transmit_and_check_msg(const String msg_append, bool perform_assert = true)
void task_delayed_msg(void *pvParameters) { void task_delayed_msg(void *pvParameters) {
HardwareSerial *selected_serial; HardwareSerial *selected_serial;
#if SOC_UART_NUM == 2 #if SOC_UART_HP_NUM == 2
selected_serial = &Serial; selected_serial = &Serial;
#elif SOC_UART_NUM == 3 #elif SOC_UART_HP_NUM == 3
selected_serial = &Serial1; selected_serial = &Serial1;
#endif #endif
...@@ -143,14 +143,14 @@ void task_delayed_msg(void *pvParameters) { ...@@ -143,14 +143,14 @@ void task_delayed_msg(void *pvParameters) {
// This function is automatically called by unity before each test is run // This function is automatically called by unity before each test is run
void setUp(void) { void setUp(void) {
start_serial(115200); 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"); log_d("Setup internal loop-back from and back to Serial1 (UART1) TX >> Serial1 (UART1) RX");
Serial1.onReceive([]() { Serial1.onReceive([]() {
onReceive_cb(Serial1); onReceive_cb(Serial1);
}); });
uart_internal_loopback(1, RX1); 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)"); log_d("Setup internal loop-back between Serial1 (UART1) <<--->> Serial2 (UART2)");
Serial1.onReceive([]() { Serial1.onReceive([]() {
...@@ -180,11 +180,11 @@ void onReceive_cb(HardwareSerial &selected_serial) { ...@@ -180,11 +180,11 @@ void onReceive_cb(HardwareSerial &selected_serial) {
if (&selected_serial == &Serial) { if (&selected_serial == &Serial) {
uart_num = 0; uart_num = 0;
#if SOC_UART_NUM >= 2 #if SOC_UART_HP_NUM >= 2
} else if (&selected_serial == &Serial1) { } else if (&selected_serial == &Serial1) {
uart_num = 1; uart_num = 1;
#endif #endif
#if SOC_UART_NUM >= 3 #if SOC_UART_HP_NUM >= 3
} else if (&selected_serial == &Serial2) { } else if (&selected_serial == &Serial2) {
uart_num = 2; uart_num = 2;
#endif #endif
...@@ -225,7 +225,7 @@ void change_baudrate_test(void) { ...@@ -225,7 +225,7 @@ void change_baudrate_test(void) {
Serial1.updateBaudRate(9600); Serial1.updateBaudRate(9600);
TEST_ASSERT_UINT_WITHIN(192, 9600, Serial1.baudRate()); TEST_ASSERT_UINT_WITHIN(192, 9600, Serial1.baudRate());
#if SOC_UART_NUM == 3 #if SOC_UART_HP_NUM == 3
Serial2.updateBaudRate(9600); Serial2.updateBaudRate(9600);
TEST_ASSERT_UINT_WITHIN(192, 9600, Serial2.baudRate()); TEST_ASSERT_UINT_WITHIN(192, 9600, Serial2.baudRate());
#endif #endif
...@@ -239,7 +239,7 @@ void change_baudrate_test(void) { ...@@ -239,7 +239,7 @@ void change_baudrate_test(void) {
//Baudrate error should be within 2% of the target baudrate //Baudrate error should be within 2% of the target baudrate
TEST_ASSERT_UINT_WITHIN(2304, 115200, Serial1.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()); TEST_ASSERT_UINT_WITHIN(2304, 115200, Serial2.baudRate());
#endif #endif
...@@ -419,20 +419,20 @@ void change_pins_test(void) { ...@@ -419,20 +419,20 @@ void change_pins_test(void) {
log_d("Disabling UART loopback"); 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); 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(RX1, SIG_GPIO_OUT_IDX, false, false);
esp_rom_gpio_connect_out_signal(RX2, SIG_GPIO_OUT_IDX, false, false); esp_rom_gpio_connect_out_signal(RX2, SIG_GPIO_OUT_IDX, false, false);
#endif #endif
log_d("Swapping UART pins"); log_d("Swapping UART pins");
#if SOC_UART_NUM == 2 #if SOC_UART_HP_NUM == 2
Serial1.setPins(NEW_RX1, NEW_TX1); Serial1.setPins(NEW_RX1, NEW_TX1);
TEST_ASSERT_EQUAL(NEW_RX1, uart_get_RxPin(1)); TEST_ASSERT_EQUAL(NEW_RX1, uart_get_RxPin(1));
TEST_ASSERT_EQUAL(NEW_TX1, uart_get_TxPin(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); Serial1.setPins(RX2, TX2);
Serial2.setPins(RX1, TX1); Serial2.setPins(RX1, TX1);
TEST_ASSERT_EQUAL(RX2, uart_get_RxPin(1)); TEST_ASSERT_EQUAL(RX2, uart_get_RxPin(1));
...@@ -445,9 +445,9 @@ void change_pins_test(void) { ...@@ -445,9 +445,9 @@ void change_pins_test(void) {
log_d("Re-enabling UART loopback"); log_d("Re-enabling UART loopback");
#if SOC_UART_NUM == 2 #if SOC_UART_HP_NUM == 2
uart_internal_loopback(1, NEW_RX1); 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(1, RX1);
uart_internal_loopback(2, RX2); uart_internal_loopback(2, RX2);
#endif #endif
...@@ -467,10 +467,10 @@ void auto_baudrate_test(void) { ...@@ -467,10 +467,10 @@ void auto_baudrate_test(void) {
log_d("Stopping test serial. Using Serial2 for ESP32 and Serial1 for ESP32-S2."); 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; selected_serial = &Serial1;
uart_internal_loopback(0, RX1); uart_internal_loopback(0, RX1);
#elif SOC_UART_NUM == 3 #elif SOC_UART_HP_NUM == 3
selected_serial = &Serial2; selected_serial = &Serial2;
#endif #endif
...@@ -485,7 +485,7 @@ void auto_baudrate_test(void) { ...@@ -485,7 +485,7 @@ void auto_baudrate_test(void) {
selected_serial->begin(0); selected_serial->begin(0);
baudrate = selected_serial->baudRate(); baudrate = selected_serial->baudRate();
#if SOC_UART_NUM == 2 #if SOC_UART_HP_NUM == 2
Serial.end(); Serial.end();
Serial.begin(115200); Serial.begin(115200);
#endif #endif
...@@ -504,7 +504,7 @@ void periman_test(void) { ...@@ -504,7 +504,7 @@ void periman_test(void) {
Wire.begin(RX1, TX1); Wire.begin(RX1, TX1);
#if SOC_UART_NUM == 3 #if SOC_UART_HP_NUM == 3
Wire1.begin(RX2, TX2); Wire1.begin(RX2, TX2);
#endif #endif
...@@ -518,11 +518,11 @@ void periman_test(void) { ...@@ -518,11 +518,11 @@ void periman_test(void) {
Serial1.setPins(RX1, TX1); Serial1.setPins(RX1, TX1);
#if SOC_UART_NUM == 3 #if SOC_UART_HP_NUM == 3
Serial2.setPins(RX2, TX2); Serial2.setPins(RX2, TX2);
uart_internal_loopback(1, RX2); uart_internal_loopback(1, RX2);
uart_internal_loopback(2, RX1); uart_internal_loopback(2, RX1);
#elif SOC_UART_NUM == 2 #elif SOC_UART_HP_NUM == 2
uart_internal_loopback(1, RX1); uart_internal_loopback(1, RX1);
#endif #endif
...@@ -565,19 +565,19 @@ void setup() { ...@@ -565,19 +565,19 @@ void setup() {
while (!Serial) { while (!Serial) {
delay(10); 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 // Begin needs to be called before setting up the loopback because it creates the serial object
start_serial(115200); 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"); log_d("Setup internal loop-back from and back to Serial1 (UART1) TX >> Serial1 (UART1) RX");
Serial1.onReceive([]() { Serial1.onReceive([]() {
onReceive_cb(Serial1); onReceive_cb(Serial1);
}); });
uart_internal_loopback(1, RX1); 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)"); log_d("Setup internal loop-back between Serial1 (UART1) <<--->> Serial2 (UART2)");
Serial1.onReceive([]() { Serial1.onReceive([]() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment