No description
Find a file
RefactorFactory 2e72894a4b
USBHIDKeyboard: Fix 200ms delay for every key (#7218)
Arduino-esp32 2.0.4 was released with a version of TinyUSB hid_device.h
that uses uint16_t for the last argument:

https://github.com/espressif/arduino-esp32/blob/2.0.4/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/hid/hid_device.h

    TU_ATTR_WEAK void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint16_t len);

But USBHID implements this callback with uint8_t:

https://github.com/espressif/arduino-esp32/blob/2.0.4/libraries/USB/src/USBHID.cpp

    void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint8_t len){
        if (tinyusb_hid_device_input_sem) {
            xSemaphoreGive(tinyusb_hid_device_input_sem);
        }
    }

The result is that when USBHIDKeyboard sends a report to the host, it
times out, waiting 100 ms for the callback to be called. It does this
once for pressing the key and once for releasing the key, so
100 ms * 2 = 200 ms.

The latest version of hid_device.h reverts the last argument to uint8_t:

860b104691/tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/hid/hid_device.h

    TU_ATTR_WEAK void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, /*uint16_t*/ uint8_t len );

But these commits suggest that the last argument will eventually be
changed to uint16_t:

556b5d5044

    change report len in hid API from uint8_t to uint16_t

    since HS interrupt endpoint can be up to 1024, 8-bit is not enough.
    affected APIs are:
    - tud_hid_n_report() / tud_hid_report()
    - tud_hid_report_complete_cb()

b495d6f8ec

    temporarily revert len back to uint8_t in tud_hid_report_complete_cb() for up coming release

To prevent this from becoming broken again, in preparation for the change
to uint16_t, make USBHID resilient to any type for the last argument for
tud_hid_report_complete_cb() by using some C++ template metaprogramming,
adapted from https://stackoverflow.com/a/22632571.

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2022-09-14 11:42:19 +03:00
.github Compile error if CONFIG_FREERTOS_HZ != 1000 (#6955) 2022-08-26 11:14:59 +03:00
cores/esp32 Get real Flash Chip Size (#7159) 2022-09-07 15:04:24 +02:00
docs Compile error if CONFIG_FREERTOS_HZ != 1000 (#6955) 2022-08-26 11:14:59 +03:00
libraries USBHIDKeyboard: Fix 200ms delay for every key (#7218) 2022-09-14 11:42:19 +03:00
package Update esptool to version 4.2.1 (#7127) 2022-08-22 17:00:42 +03:00
tests Added NVS test sketch + test script (#6885) 2022-08-15 14:47:07 +02:00
tools Update PlatformIO build scripts (#7200) 2022-09-06 11:39:03 -03:00
variants Add default SPI pin definitions if not defined in pins_arduino.h (#7161) 2022-09-14 11:29:12 +03:00
.gitignore Update .gitignore (#7021) 2022-08-22 14:16:55 +03:00
.gitmodules v2.0.0 Add support for ESP32S2 and update ESP-IDF to 4.4 (#4996) 2021-04-05 14:23:58 +03:00
boards.txt add TAMC Termod S3 (#7217) 2022-09-06 22:45:00 +02:00
CMakeLists.txt Compile error if CONFIG_FREERTOS_HZ != 1000 (#6955) 2022-08-26 11:14:59 +03:00
CONTRIBUTING.rst Add files via upload - CONTRIBUTING.rst (#5138) 2021-05-18 13:54:25 +03:00
idf_component.yml Esp32 s3 support (#6341) 2022-03-28 12:09:41 +03:00
Kconfig.projbuild Enable configuring target variants (#7019) 2022-08-22 14:16:38 +03:00
LICENSE.md Add LGPL 2.1 License 2019-04-16 03:08:50 +02:00
package.json Update core version 2022-05-04 18:55:21 +03:00
platform.txt Add erase flash option to Arduino IDE menu (#7043) 2022-08-10 08:23:12 -03:00
programmers.txt Add support for ArduinoIDE 2.0.0 (#6506) 2022-04-04 17:19:23 +03:00
README.md Pull request/Issue Templates and Readme update (#6577) 2022-04-21 17:54:50 +03:00

Arduino core for the ESP32, ESP32-S2, ESP32-S3 and ESP32-C3

Build Status Documentation Status

Need help or have a question? Join the chat at https://gitter.im/espressif/arduino-esp32 or open a new Discussion

Contents

Development Status

Latest Stable Release Release Version Release Date Downloads

Latest Development Release Release Version Release Date Downloads

Development Planning

Our Development is fully tracked on this public Roadmap 🎉

For even more information you can take a look at Sprint Meeting notes or join Monthly Community Meetings 🔔

Documentation

You can use the Arduino-ESP32 Online Documentation to get all information about this project.

Supported Chips

Visit the supported chips documentation to see the list of current supported ESP32 SoCs.

Decoding exceptions

You can use EspExceptionDecoder to get meaningful call trace.

Issue/Bug report template

Before reporting an issue, make sure you've searched for similar one that was already created. Also make sure to go through all the issues labelled as Type: For reference.

Finally, if you are sure no one else had the issue, follow the Issue template or Feature request template while reporting any new Issue.

Contributing

We welcome contributions to the Arduino ESP32 project!

See contributing in the documentation for more information on how to contribute to the project.