* Makes sure it can be tested with Windows 10/11
Initial code had no effect with Win10/11 because BUTTON_START was not recognized.
This change makes it visible in the Windows Game Controller Testing TAB.
* Examples tests all USB gamepad APIs.
It is possible to change the selected gamepad button when pressing BOOT (long/short press).
The selected button is used as parameter to change R/L Stick and Trigger as well as the Hat.
* Remove __FlashStringHelper from ESP32, it's not needed - all the files using it are different from their ESP8266 counterparts anyway.
* Revert removal of class __FlashStringHelper forward for continued compatibility with external libs
* Improved fix, works for libs that return const __FlashStringHelper*
* Inline all wrappers using const __FlashStringHelper*.
* new variant Seeed XIAO_ESP32S3
* add pin define for camera example
* Remove excess comments and fix minor errors
---------
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
* Changed data type of temperature
* Changed data type in EddystoneTLM class and example
* Revert "Changed data type in EddystoneTLM class and example"
This reverts commit 1f3a9414ee13341f80bd6d51cdbd57254aadfe97.
* Draft of Eddystone TLM example
* Adds MACROs to convert beacon temperature
2 Macros
EDDYSTONE_TEMP_U16_TO_FLOAT(tempU16) - takes the TLM BigEndian 8.8 fixed point representation and returns its float value
EDDYSTONE_TEMP_FLOAT_TO_U16(tempFloat) - takes a float (temperature) and returns its BigEndian 8.8 fixed point representation
* Fixed temp
* Changed to conform with PR comments
* Fixed comment on closing bracket
* Prints negative TEMP big endian as just 2 bytes
* Extacts correct Eddyston Service Data
* Fixes BLEEddystoneTLM::toString() negative temp
* Fixes URL field length
* Fixes Eddystone URL decoding
* Fixes MSB for iBeacon UUID
iBeacons use big endian BLE fields.
* Fix to detect iBeacon that also has Service UUID
This fix makes the BLE_iBeacon.ino to work correctly with the BLE_Beacon_Scanner.ino example
---------
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
* Remove inline code comments for the struct description
* Renamed ESPNow examples
* Changed example from C++ class to C struct
* Updated MultiHomedServers
* Updated BT Serial examples
* Added short overview of exaples - missing Enterprise
* Added draft of Enterprise header note
* Fixed note in README
* Fixed compilation error
* Changed FunctionalInterrupt example
* Fixes
* Returned FunctionalInterrupts to original state + added modified version as new example
* Added methods + example to retrive local MAC for BT
* Added .skip files in the new example folder
* Fixed typos and formatting + added doxygen comments
* changed std::string to String
* another std::string -> String
* Changed std::string to String
* chaged string type in example
* Moved and renamed example ESP32/FreeRTOS to MultiThreading/BasicMultiThreading
* Added dummy files
* Modified original example
* Fixed BasicMultiThreading.ino
* Added Example demonstrating use of queues
* Extended info in BasicMultiThreading
* Renamed Queues to singular Queue
* Added Mutex example
* Added Semaphore example
* Moved info from example to README
* Moved doc from Mutex to README
* Added Queue README
* Removed unecesary text
* Fixed grammar
* Increased stack size for Sempahore example
* Added headers into .ino files
* Added word Example at the end of title in README
* removed unused line
* Added forgotten README
* Modified BasicMultiThreading example
* Added missing S3 entry in README
* moved location
[ESP32: SDMMCFS::begin hardcodes the usage of slot 1, only check if the pins match slot 1 pins.]
setPins() was testing pins D1, D2 and D3 all against D1 ... fine in 1 pin mode when all are -1 not so much if you're trying to get 4 pin mode working.
I now see this function doesn't really do anything on the ESP32...accept now correctly checks that you are trying to use the slot 1 pins.
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
* Update WiFiClient.cpp
This change will allow specifying connect timeouts below 1 second. Without this change, if connect timeouts under 1 second are given, the connect defaults to 0ms and fails.
This will also allow timeouts in fractions of seconds, e.g. 1500ms. Without this change, connect timeouts are truncated to full second increments.
* Make parameter timeout_ms clear
* Change connection timeout_ms name for clarity
---------
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
* Fixes BLE data printing
BLE data has no '\0' terminator, therefore it can't be printed as a regular C string.
This fix just prints the BLE data based on its length.
* Simplify printing to a single call
* Modified WiFiClient example to use thingspeak instead of non-functionig sparkfun
* Moved instructions to README
* Fixed spelling
* Added link to S3 datasheet
---------
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
* Fixed issue where esp32 won't reconnect to WiFi AP if the AP was restarted
* Added the autoReconnect condition and removed the reconnect reason
* Chenges on the WiFi reconnection and added new example
* Added new line at the end
* Changes reverted with some minor changes. New example remained
* Changes reverted and sync
Co-authored-by: pedro.minatel <pedro.minatel@espressif.com>
* ESP Insights: Added library support
* ESP Insights: Added Examples
* ESP Insights: Added custom partitions file
* ESP Insights: Added API documentation.
* Added recipe and script to create Insights package
* Updated ESP Insights examples.
* Changed Insights Firmware package output directory
* Changed license to include SPDX license
* Fix Insights package for Windows
* Updated .exe of insights script
* Added coredump partition to all schemes
* Updated header files of Insights diagnostics
* hotfix: Added elf-sha256-offset flag in elf2bin
builder
* Update API to be more Arduino-like and partitions offsets
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
* adds extended HardwareSerial examples
* Adds new example with Serial RxTimeout
* adds and improves Serial onReceive expamples
* adjust includes CMake - UART example
* adjust includes CMake - UART example
* fixes CMake and CI
* adds ESP/Serial to CMakeList
* adds ESP/Serial to CMakeList
* fixes demo include
* fixes BREAK demo
* fixes onReceive demo
* Changes FIFO Full criteria
Changed the "1-by-1" Serial only when baud rate is 57600 or lower.
* example code replacement
* replaces functions in hal
* Update `WiFiScan` example to show more useful data
* Add channel to output.
* Add type of encryption to output.
* Format output as table.
* Update outdated example description.
* Add `scanDelete()` as hint to free memory.
* added 32 chars SSID + readme edit
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
* replaced original iBeacon example with a known-good one
* addressed VojtechBartoska's comment
* incorporated P-R-O-C-H-Y's change
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
* refactor(toString method): Add RSSI / serviceData
These are key characteristics of the BLE advertising packet. Really useful, adding to this method allows data to be easily obtained and passed over TCP/IP for processing.
* fix: remove line 565 bug
Currently, if a second connection occur in Bluetooth, this second connection is automatically disconnected (line 284).
This disconnection trigger the ESP_SPP_CLOSE_EVT, which clear the bit SPP_CONNECTED.
But the first connection remain active, and this flag shouldn't be cleared.
This fix the issue, by clearing the flag only if the last connection is closed
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
This commit addes an example showing how to receive messages using the TWAI
driver interface and a CAN transceiver. Specifically, the example demonstrates:
- How to configure and install the TWAI drvier
- How to poll for TWAI events (i.e., alerts) using twai_read_alerts()
- How to handle the various events (such as TWAI_ALERT_RX_DATA)
Closes https://github.com/espressif/arduino-esp32/pull/7430
Co-authored-by: Stephan Martin <designer2k2@gmail.com>
* Added enableScenes API
* Added enableScenes API documentation
* Added enableScenes API to example
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Fixed#7406 . The "reason2str" macro in WiFiGeneric.cpp tries to read memory from index "-1" in "system_event_reasons" array when handling STA_DISCONNECTED event with reason 0. Dealing with reason 0 as a reason 1 (WIFI_REASON_UNSPECIFIED) will solve the problem (the reason for this event to arrive with reason 0 is unknown). #7406
The original code assumes 100Hz FreeRTOS tick rate and just supplies vTaskDelay with the assumed number of ticks required for the wanted delay. This patch simply fixes it to use portTICK_PERIOD_MS, thereby working correctly regardless of what tick rate FreeRTOS has been configured to run at.
The HID semaphore allows USBHID::SendReport() to wait for the completion of
report sending.
With a zero timeout xSemaphoreTake() after calling tud_hid_n_report(),
occasionally, the following would happening:
1. USBHID::SendReport() would send a report by calling tud_hid_n_report().
2. The send would complete and (presumably on another thread)
tud_hid_report_complete_cb() would be called and it would xSemaphoreGive()
the semaphore.
3. In USBHID::SendReport(), the zero timeout xSemaphoreTake(sem, 0) would
succeed, taking the semaphore.
4. On the next line, xSemaphoreTake(sem, timeout_ms ...) would timeout
because the semaphore was already taken by the previous line of code.
The result would be waiting timeout_ms for no reason.
The purpose of the zero timeout xSemaphoreTake() is to clear the semaphore in
case a previous SendReport() timed out waiting for the semaphore. In that case,
tud_hid_report_complete_cb() may be called after the timeout, giving the
semaphore. Then the next SendReport() would start with the semaphore given,
which isn't desired if we want to call xSemaphoreTake(sem, timeout_ms ...) on
it.
There have also been other cases where tud_hid_report_complete_cb() is called
an extra time, causing the same situation.
The fix is to move the zero timeout xSemaphoreTake() before the call to
tud_hid_n_report(). This eliminates the race between the zero timeout
xSemaphoreTake() and tud_hid_report_complete_cb() in the common case when no
timeout occurs.
There is still a possible race condition between the zero timeout
xSemaphoreTake() and tud_hid_report_complete_cb() in the case of a timeout,
but that should be rarer.
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>
* Removed option to change CHANNEL
* Revert "Removed option to change CHANNEL"
This reverts commit b2ec27de1d2d4703a15f6397550a46896413828a.
* Fixed the ability to change CHANNEL
* WiFi scan only on selected channel
otherwise the compiler will complain about unused variable event
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
* Improve RGB LED Driver
Replaces the use of the `LED_BUILTIN` variable by creating a new variable called `RGB_BUILTIN`. On boards with both a regular LED and RGB LED, this change provides functionality to control either LED.
The `LED_BRIGHTNESS` variable is changed to `RGB_BRIGHTNESS`, which aligns more closely with the `RGB_BUILTIN` variable name.
`BOARD_HAS_NEOPIXEL` is no longer necessary; it is replaced by `RGB_BUILTIN`.
* Update BlinkRGB example
Update example code for changes with the RGB driver:
- Replace `LED_BUILTIN` and `BOARD_HAS_NEOPIXEL` with `RGB_BUILTIN`
- Replace `LED_BRIGHTNESS` with `RGB_BRIGHTNESS`
* Update board variants
Update board variants for changes with the RGB driver:
- Remove `BOARD_HAS_NEOPIXEL`
- Define `RGB_BUILTIN` pin
- Replace `LED_BRIGHTNESS` with `RGB_BRIGHTNESS` to align with `RGB_BUILTIN` name
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
Co-authored-by: Vojtěch Bartoška <76958047+VojtechBartoska@users.noreply.github.com>
With recent compiler update, the following warning is generated:
packages/esp32/hardware/esp32/2.0.4/libraries/LittleFS/src/LittleFS.cpp:85:5: warning: missing initializer for member 'esp_vfs_littlefs_conf_t::dont_mount' [-Wmissing-field-initializers]
This commit adds the missing identifier.
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
* Added definitions for various parameters and UI types.
* Overload for `const char*` added.
* Function `addValidStrList` added.
This is needed for mode parameters (see example RMakerCustomAirCooler.ino).
* Example of a custom device that uses toggle, mode and range parameters.
* Revert: Added definitions for various parameters and UI types.
* Fixed declaration for addValidStrList
* Fixed missing gpio definition for ESP32C3 target
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Description of Change
Original code does not work (crashing) - related issue #6832 - now fixed.
Extended description to be more helpful.
Added options to modify the setup at the top of the code via constants.
Added option do plot with Arduino Serial plotter.
Even if the crashing was solved alone the ledc PWM would not output any signal.
Tests scenarios
Tested on ESP32 with oscilloscope and signal generator.
Related links
Closing #6832
Fixed issue with ssl_client->socket being closed without being consistently set to -1. Changed close to lwip_close to be consistent with lwip_socket, resolved issue with long term assert after 4+ days (assert failed: lock_release_generic locks.c:186).
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
Description of Change
This PR fixes an issue related to BLE Server and Descriptors.
The issue:
If the BLE Server code changes its own descriptors, it is not reflected in the GATTS database.
BLE2902 CCCD also didn't reflect any changes to the GATTS database.
Because of this issue, the client could never read the real Descriptor values from the remote Server.
Tests scenarios
Tested with ESP32.
Related links
Fixes#6863Fixes#6868
* Initial implementation of RGB driver via digitalWrite
* Moved constants to pins_arduino.h
* Changed pin definition + added example
* Wrapped BlinkRGB in #ifdef BOARD_HAS_NEOPIXEL
* Removed forgotten log from example
* Moved RGBLedWrite to new file esp32-hal-rgb-led and created pinMode in variatn.cpp
* Updated example - lowered single channel brightness to LED_BRIGHTNESS
* Changed function name from RGBLedWrite to neopixelWrite + code polishing
* Moved pinSetup portion related to RGB back to common file