8000 Merge branch 'master' into tests/new_wokwi_tests · espressif/arduino-esp32@4e31e15 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4e31e15

Browse files
authored
Merge branch 'master' into tests/new_wokwi_tests
2 parents 9396387 + 646785e commit 4e31e15
  • Matter
  • NetBIOS
  • NetworkClientSecure
  • Network
  • OpenThread
  • PPP
  • Preferences
  • RainMaker
  • SD_MMC
  • SD
  • SPIFFS
  • SPI
  • SimpleBLE
  • TFLiteMicro
  • Ticker
  • USB
  • Update
  • WebServer
  • WiFiProv
  • WiFi
  • Wire
  • Zigbee
  • package
  • tests
  • tools/partitions
  • variants
  • Some content is hidden

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

    144 files changed

    +4061
    -750
    lines changed

    .github/ISSUE_TEMPLATE/Issue-report.yml

    Lines changed: 2 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -41,6 +41,8 @@ body:
    4141
    options:
    4242
    - latest master (checkout manually)
    4343
    - latest development Release Candidate (RC-X)
    44+
    - v3.1.2
    45+
    - v3.1.1
    4446
    - v3.1.0
    4547
    - v3.0.7
    4648
    - v3.0.6

    .github/ISSUE_TEMPLATE/config.yml

    Lines changed: 3 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,8 +1,8 @@
    11
    blank_issues_enabled: false
    22
    contact_links:
    3-
    - name: Arduino ESP32 Gitter Channel
    4-
    url: https://gitter.im/espressif/arduino-esp32
    5-
    about: Community channel for questions and help
    3+
    - name: Arduino Core for Espressif Discord Server
    4+
    url: https://discord.gg/8xY6e9crwv
    5+
    about: Community Discord server for questions and help
    66
    - name: ESP32 Forum - Arduino
    77
    url: https://esp32.com/viewforum.php?f=19
    88
    about: Official Forum for questions

    .github/workflows/push.yml

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -245,7 +245,7 @@ jobs:
    245245
    # See https://hub.docker.com/r/espressif/idf/tags and
    246246
    # https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html
    247247
    # for details.
    248-
    idf_ver: ["release-v5.3"]
    248+
    idf_ver: ["release-v5.4"]
    249249
    idf_target:
    250250
    [
    251251
    "esp32",

    CMakeLists.txt

    Lines changed: 6 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -6,7 +6,7 @@
    66
    # idf.py build
    77

    88
    set(min_supported_idf_version "5.3.0")
    9-
    set(max_supported_idf_version "5.3.99")
    9+
    set(max_supported_idf_version "5.4.99")
    1010
    set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}")
    1111

    1212
    if ("${idf_version}" AND NOT "$ENV{ARDUINO_SKIP_IDF_VERSION_CHECK}")
    @@ -33,6 +33,7 @@ set(CORE_SRCS
    3333
    cores/esp32/esp32-hal-dac.c
    3434
    cores/esp32/esp32-hal-gpio.c
    3535
    cores/esp32/esp32-hal-i2c.c
    36+
    cores/esp32/esp32-hal-i2c-ng.c
    3637
    cores/esp32/esp32-hal-i2c-slave.c
    3738
    cores/esp32/esp32-hal-ledc.c
    3839
    cores/esp32/esp32-hal-matrix.c
    @@ -290,6 +291,10 @@ set(ARDUINO_LIBRARY_Zigbee_SRCS
    290291
    libraries/Zigbee/src/ep/ZigbeePressureSensor.cpp
    291292
    libraries/Zigbee/src/ep/ZigbeeOccupancySensor.cpp
    292293
    libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.cpp
    294+
    libraries/Zigbee/src/ep/ZigbeeContactSwitch.cpp
    295+
    libraries/Zigbee/src/ep/ZigbeeDoorWindowHandle.cpp
    296+
    libraries/Zigbee/src/ep/ZigbeeWindowCovering.cpp
    297+
    libraries/Zigbee/src/ep/ZigbeeVibrationSensor.cpp
    293298
    )
    294299

    295300
    set(ARDUINO_LIBRARY_BLE_SRCS

    README.md

    Lines changed: 3 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,9 @@
    55
    [![External Libraries Test](https://img.shields.io/github/actions/workflow/status/espressif/arduino-esp32/lib.yml?branch=master&event=schedule&label=External%20Libraries%20Test)](https://github.com/espressif/arduino-esp32/blob/gh-pages/LIBRARIES_TEST.md)
    66
    [![Runtime Tests](https://github.com/espressif/arduino-esp32/blob/gh-pages/runtime-tests-results/badge.svg)](https://github.com/espressif/arduino-esp32/actions/workflows/tests_results.yml)
    77

    8-
    ### Need help or have a question? Join the chat at [Gitter](https://gitter.im/espressif/arduino-esp32) or [open a new Discussion](https://github.com/espressif/arduino-esp32/discussions)
    8+
    ### Need help or have a question? Join the chat at [Discord](https://discord.gg/8xY6e9crwv) or [open a new Discussion](https://github.com/espressif/arduino-esp32/discussions)
    9+
    10+
    [![Discord invite](https://img.shields.io/discord/1327272229427216425?logo=discord&logoColor=white&logoSize=auto&label=Discord)](https://discord.gg/8xY6e9crwv)
    911

    1012
    ## Contents
    1113

    boards.txt

    Lines changed: 283 additions & 179 deletions
    Large diffs are not rendered by default.

    cores/esp32/Arduino.h

    Lines changed: 4 additions & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -33,14 +33,17 @@
    3333
    #include "freertos/FreeRTOS.h"
    3434
    #include "freertos/task.h"
    3535
    #include "freertos/semphr.h"
    36-
    #include "esp32-hal.h"
    3736
    #include "esp8266-compat.h"
    3837
    #include "soc/gpio_reg.h"
    3938

    4039
    #include "stdlib_noniso.h"
    4140
    #include "binary.h"
    4241
    #include "extra_attr.h"
    4342

    43+
    #include "pins_arduino.h"
    44+
    #include "io_pin_remap.h"
    45+
    #include "esp32-hal.h"
    46+
    4447
    #define PI 3.1415926535897932384626433832795
    4548
    #define HALF_PI 1.5707963267948966192313216916398
    4649
    #define TWO_PI 6.283185307179586476925286766559
    @@ -248,8 +251,4 @@ void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
    248251
    void noTone(uint8_t _pin);
    249252

    250253
    #endif /* __cplusplus */
    251-
    252-
    #include "pins_arduino.h"
    253-
    #include "io_pin_remap.h"
    254-
    255254
    #endif /* _ESP32_CORE_ARDUINO_H_ */

    cores/esp32/FirmwareMSC.cpp

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -19,8 +19,8 @@
    1919
    #include "esp_partition.h"
    2020
    #include "esp_ota_ops.h"
    2121
    #include "esp_image_format.h"
    22-
    #include "esp32-hal.h"
    2322
    #include "pins_arduino.h"
    23+
    #include "esp32-hal.h"
    2424
    #include "firmware_msc_fat.h"
    2525
    #include "spi_flash_mmap.h"
    2626

    cores/esp32/HardwareSerial.cpp

    Lines changed: 84 additions & 42 deletions
    Original file line numberDiff line numberDiff line change
    @@ -23,40 +23,52 @@
    2323
    #define ARDUINO_SERIAL_EVENT_TASK_RUNNING_CORE -1
    2424
    #endif
    2525

    26+
    #if (SOC_UART_LP_NUM >= 1)
    27+
    #define UART_HW_FIFO_LEN(uart_num) ((uart_num < SOC_UART_HP_NUM) ? SOC_UART_FIFO_LEN : SOC_LP_UART_FIFO_LEN)
    28+
    #else
    29+
    #define UART_HW_FIFO_LEN(uart_num) SOC_UART_FIFO_LEN
    30+
    #endif
    31+
    2632
    void serialEvent(void) __attribute__((weak));
    2733

    28-
    #if SOC_UART_HP_NUM > 1
    34+
    #if SOC_UART_NUM > 1
    2935
    void serialEvent1(void) __attribute__((weak));
    30-
    #endif /* SOC_UART_HP_NUM > 1 */
    36+
    #endif /* SOC_UART_NUM > 1 */
    3137

    32-
    #if SOC_UART_HP_NUM > 2
    38+
    #if SOC_UART_NUM > 2
    3339
    void serialEvent2(void) __attribute__((weak));
    34-
    #endif /* SOC_UART_HP_NUM > 2 */
    40+
    #endif /* SOC_UART_NUM > 2 */
    3541

    36-
    #if SOC_UART_HP_NUM > 3
    42+
    #if SOC_UART_NUM > 3
    3743
    void serialEvent3(void) __attribute__((weak));
    38-
    #endif /* SOC_UART_HP_NUM > 3 */
    44+
    #endif /* SOC_UART_NUM > 3 */
    3945

    40-
    #if SOC_UART_HP_NUM > 4
    46+
    #if SOC_UART_NUM > 4
    4147
    void serialEvent4(void) __attribute__((weak));
    42-
    #endif /* SOC_UART_HP_NUM > 4 */
    48+
    #endif /* SOC_UART_NUM > 4 */
    49+
    50+
    #if SOC_UART_NUM > 5
    51+
    void serialEvent5(void) __attribute__((weak));
    52+
    #endif /* SOC_UART_NUM > 5 */
    4353

    4454
    #if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
    4555
    // There is always Seria0 for UART0
    4656
    HardwareSerial Serial0(0);
    47-
    #if SOC_UART_HP_NUM > 1
    57+
    #if SOC_UART_NUM > 1
    4858
    HardwareSerial Serial1(1);
    4959
    #endif
    50-
    #if SOC_UART_HP_NUM > 2
    60+
    #if SOC_UART_NUM > 2
    5161
    HardwareSerial Serial2(2);
    5262
    #endif
    53-
    #if SOC_UART_HP_NUM > 3
    63+
    #if SOC_UART_NUM > 3
    5464
    HardwareSerial Serial3(3);
    5565
    #endif
    56-
    #if SOC_UART_HP_NUM > 4
    66+
    #if SOC_UART_NUM > 4
    5767
    HardwareSerial Serial4(4);
    5868
    #endif
    59-
    69+
    #if (SOC_UART_NUM > 5)
    70+
    HardwareSerial Serial5(5);
    71+
    #endif
    6072
    #if HWCDC_SERIAL_IS_DEFINED == 1 // Hardware JTAG CDC Event
    6173
    extern void HWCDCSerialEvent(void) __attribute__((weak));
    6274
    #endif
    @@ -81,26 +93,31 @@ void serialEventRun(void) {
    8193
    if (serialEvent && Serial0.available()) {
    8294
    serialEvent();
    8395
    }
    84-
    #if SOC_UART_HP_NUM > 1
    96+
    #if SOC_UART_NUM > 1
    8597
    if (serialEvent1 && Serial1.available()) {
    8698
    serialEvent1();
    8799
    }
    88100
    #endif
    89-
    #if SOC_UART_HP_NUM > 2
    101+
    #if SOC_UART_NUM > 2
    90102
    if (serialEvent2 && Serial2.available()) {
    91103
    serialEvent2();
    92104
    }
    93105
    #endif
    94-
    #if SOC_UART_HP_NUM > 3
    106+
    #if SOC_UART_NUM > 3
    95107
    if (serialEvent3 && Serial3.available()) {
    96108
    serialEvent3();
    97109
    }
    98110
    #endif
    99-
    #if SOC_UART_HP_NUM > 4
    111+
    #if SOC_UART_NUM > 4
    100112
    if (serialEvent4 && Serial4.available()) {
    101113
    serialEvent4();
    102114
    }
    103115
    #endif
    116+
    #if SOC_UART_NUM > 5
    117+
    if (serialEvent5 && Serial5.available()) {
    118+
    serialEvent5();
    119+
    }
    120+
    #endif
    104121
    }
    105122
    #endif
    106123

    @@ -185,7 +202,8 @@ void HardwareSerial::onReceive(OnReceiveCb function, bool onlyOnTimeout) {
    185202

    186203
    // in case that onReceive() shall work only with RX Timeout, FIFO shall be high
    187204
    // this is a work around for an IDF issue with events and low FIFO Full value (< 3)
    188-
    if (_onReceiveTimeout) {
    205+
    // Not valid for the LP UART
    206+
    if (_onReceiveTimeout && _uart_nr < SOC_UART_HP_NUM) {
    189207
    uartSetRxFIFOFull(_uart, 120);
    190208
    log_w("OnReceive is set to Timeout only, thus FIFO Full is now 120 bytes.");
    191209
    }
    @@ -207,12 +225,13 @@ bool HardwareSerial::setRxFIFOFull(uint8_t fifoBytes) {
    207225
    HSERIAL_MUTEX_LOCK();
    208226
    // in case that onReceive() shall work only with RX Timeout, FIFO shall be high
    209227
    // this is a work around for an IDF issue with events and low FIFO Full value (< 3)
    210-
    if (_onReceiveCB != NULL && _onReceiveTimeout) {
    228+
    // Not valid for the LP UART
    229+
    if (_onReceiveCB != NULL && _onReceiveTimeout && _uart_nr < SOC_UART_HP_NUM) {
    211230
    fifoBytes = 120;
    212231
    log_w("OnReceive is set to Timeout only, thus FIFO Full is now 120 bytes.");
    213232
    }
    214233
    bool retCode = uartSetRxFIFOFull(_uart, fifoBytes); // Set new timeout
    215-
    if (fifoBytes > 0 && fifoBytes < SOC_UART_FIFO_LEN - 1) {
    234+
    if (fifoBytes > 0 && fifoBytes < UART_HW_FIFO_LEN(_uart_nr) - 1) {
    216235
    _rxFIFOFull = fifoBytes;
    217236
    }
    218237
    HSERIAL_MUTEX_UNLOCK();
    @@ -298,8 +317,8 @@ void HardwareSerial::_uartEventTask(void *args) {
    298317
    }
    299318

    300319
    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) {
    301-
    if (_uart_nr >= SOC_UART_HP_NUM) {
    302-
    log_e("Serial number is invalid, please use a number from 0 to %u", SOC_UART_HP_NUM - 1);
    320+
    if (_uart_nr >= SOC_UART_NUM) {
    321+
    log_e("Serial number is invalid, please use a number from 0 to %u", SOC_UART_NUM - 1);
    303322
    return;
    304323
    }
    305324

    @@ -333,16 +352,16 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
    333352
    txPin = _txPin < 0 ? (int8_t)SOC_TX0 : _txPin;
    334353
    }
    335354
    break;
    336-
    #if SOC_UART_HP_NUM > 1 // may save some flash bytes...
    355+
    #if SOC_UART_HP_NUM > 1
    337356
    case UART_NUM_1:
    338357
    if (rxPin < 0 && txPin < 0) {
    339358
    // do not change RX1/TX1 if it has already been set before
    340359
    rxPin = _rxPin < 0 ? (int8_t)RX1 : _rxPin;
    341360
    txPin = _txPin < 0 ? (int8_t)TX1 : _txPin;
    342361
    }
    343362
    break;
    344-
    #endif
    345-
    #if SOC_UART_HP_NUM > 2 // may save some flash bytes...
    363+
    #endif // UART_NUM_1
    364+
    #if SOC_UART_HP_NUM > 2
    346365
    case UART_NUM_2:
    347366
    if (rxPin < 0 && txPin < 0) {
    348367
    // do not change RX2/TX2 if it has already been set before
    @@ -354,11 +373,11 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
    354373
    #endif
    355374
    }
    356375
    break;
    357-
    #endif
    358-
    #if SOC_UART_HP_NUM > 3 // may save some flash bytes...
    376+
    #endif // UART_NUM_2
    377+
    #if SOC_UART_HP_NUM > 3
    359378
    case UART_NUM_3:
    360379
    if (rxPin < 0 && txPin < 0) {
    361-
    // do not change RX2/TX2 if it has already been set before
    380+
    // do not change RX3/TX3 if it has already been set before
    362381
    #ifdef RX3
    363382
    rxPin = _rxPin < 0 ? (int8_t)RX3 : _rxPin;
    364383
    #endif
    @@ -367,11 +386,11 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
    367386
    #endif
    368387
    }
    369388
    break;
    370-
    #endif
    371-
    #if SOC_UART_HP_NUM > 4 // may save some flash bytes...
    389+
    #endif // UART_NUM_3
    390+
    #if SOC_UART_HP_NUM > 4
    372391
    case UART_NUM_4:
    373392
    if (rxPin < 0 && txPin < 0) {
    374-
    // do not change RX2/TX2 if it has already been set before
    393+
    // do not change RX4/TX4 if it has already been set before
    375394
    #ifdef RX4
    376395
    rxPin = _rxPin < 0 ? (int8_t)RX4 : _rxPin;
    377396
    #endif
    @@ -380,7 +399,20 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
    380399
    #endif
    381400
    }
    382401
    break;
    402+
    #endif // UART_NUM_4
    403+
    #if (SOC_UART_LP_NUM >= 1)
    404+
    case LP_UART_NUM_0:
    405+
    if (rxPin < 0 && txPin < 0) {
    406+
    // do not change RX0_LP/TX0_LP if it has already been set before
    407+
    #ifdef LP_RX0
    408+
    rxPin = _rxPin < 0 ? (int8_t)LP_RX0 : _rxPin;
    409+
    #endif
    410+
    #ifdef LP_TX0
    411+
    txPin = _txPin < 0 ? (int8_t)LP_TX0 : _txPin;
    383412
    #endif
    413+
    }
    414+
    break;
    415+
    #endif // LP_UART_NUM_0
    384416
    }
    385417
    }
    386418

    @@ -445,7 +477,8 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
    445477
    if (!_rxFIFOFull) { // it has not being changed before calling begin()
    446478
    // set a default FIFO Full value for the IDF driver
    447479
    uint8_t fifoFull = 1;
    448-
    if (baud > 57600 || (_onReceiveCB != NULL && _onReceiveTimeout)) {
    480+
    // if baud rate is higher than 57600 or onReceive() is set, it will set FIFO Full to 120 bytes, except for LP UART
    481+
    if (_uart_nr < SOC_UART_HP_NUM && (baud > 57600 || (_onReceiveCB != NULL && _onReceiveTimeout))) {
    449482
    fifoFull = 120;
    450483
    }
    451484
    uartSetRxFIFOFull(_uart, fifoFull);
    @@ -477,6 +510,12 @@ void HardwareSerial::setDebugOutput(bool en) {
    477510
    if (_uart == 0) {
    478511
    return;
    479512
    }
    513+
    #if (SOC_UART_LP_NUM >= 1)
    514+
    if (_uart_nr >= SOC_UART_HP_NUM) {
    515+
    log_e("LP UART does not support Debug Output.");
    516+
    return;
    517+
    }
    518+
    #endif
    480519
    if (en) {
    481520
    uartSetDebug(_uart);
    482521
    } else {
    @@ -581,34 +620,37 @@ bool HardwareSerial::setMode(SerialMode mode) {
    581620
    }
    582621

    583622
    // minimum total RX Buffer size is the UART FIFO space (128 bytes for most SoC) + 1. IDF imposition.
    623+
    // LP UART has FIFO of 16 bytes
    584624
    size_t HardwareSerial::setRxBufferSize(size_t new_size) {
    585625

    586626
    if (_uart) {
    587627
    log_e("RX Buffer can't be resized when Serial is already running. Set it before calling begin().");
    588628
    return 0;
    589629
    }
    590-
    591-
    if (new_size <= SOC_UART_FIFO_LEN) {
    592-
    log_w("RX Buffer set to minimum value: %d.", SOC_UART_FIFO_LEN + 1); // ESP32, S2, S3 and C3 means higher than 128
    593-
    new_size = SOC_UART_FIFO_LEN + 1;
    630+
    uint8_t FIFOLen = UART_HW_FIFO_LEN(_uart_nr);
    631+
    // Valid value is higher than the FIFO length
    632+
    if (new_size <= FIFOLen) {
    633+
    new_size = FIFOLen + 1;
    634+
    log_w("RX Buffer set to minimum value: %d.", new_size);
    594635
    }
    595636

    596637
    _rxBufferSize = new_size;
    597638
    return _rxBufferSize;
    598639
    }
    599640

    600-
    // minimum total TX Buffer size is the UART FIFO space (128 bytes for most SoC).
    641+
    // minimum total TX Buffer size is the UART FIFO space (128 bytes for most SoC) + 1.
    642+
    // LP UART has FIFO of 16 bytes
    601643
    size_t HardwareSerial::setTxBufferSize(size_t new_size) {
    602644

    603645
    if (_uart) {
    604646
    log_e("TX Buffer can't be resized when Serial is already running. Set it before calling begin().");
    605647
    return 0;
    606648
    }
    607-
    608-
    if (new_size <= SOC_UART_FIFO_LEN) {
    609-
    log_w("TX Buffer set to minimum value: %d.", SOC_UART_FIFO_LEN); // ESP32, S2, S3 and C3 means higher than 128
    610-
    _txBufferSize = 0; // it will use just UART FIFO with SOC_UART_FIFO_LEN bytes (128 for most SoC)
    611-
    return SOC_UART_FIFO_LEN;
    649+
    uint8_t FIFOLen = UART_HW_FIFO_LEN(_uart_nr);
    650+
    // Valid values are zero or higher than the FIFO length
    651+
    if (new_size > 0 && new_size <= FIFOLen) {
    652+
    new_size = FIFOLen + 1;
    653+
    log_w("TX Buffer set to minimum value: %d.", new_size);
    612654
    }
    613655
    // if new_size is higher than SOC_UART_FIFO_LEN, TX Ringbuffer will be active and it will be used to report back "availableToWrite()"
    614656
    _txBufferSize = new_size;

    0 commit comments

    Comments
     (0)
    0