* Workaround for when USB CDC is unplugged
* Considers default TX timeout
Sets back default TX timeout whenever USB is plugged, otherwise it is kept as zero.
* fixed left over code
Issue: Serial data sent during frequency change is corrupted.
Fixes corrupt debug message by printing the message after the frequency change is completed.
* Changes UART ISR to only trigger on RX FIFO Full and timeout
* changes initial RX timeout
* Eliminates extra testing for _uart != NULL
* reconfiguration with "uartSetFastReading()"
* Adds new function "uartSetFastReading()"
* changed default onReceive() behaviour
* forces User callback in case of error
* Error Code Order
Set NO_ERROR as first error code, same as ESP_OK = 0
* Adds an error message to HardwareSerial::setPins()
In order to avoid problems if the user tries to setPins() before initializing the Serial port with begin()
* Get channel assigned to the pin with analogWrite
* Respect coding standard in LEDC source file
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>
* 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
espressif/esp-idf / components/driver/include/driver/uart.h defines the API:
esp_err_t uart_set_pin(uart_port_t uart_num, int tx_io_num, int rx_io_num, int **rts_io_num**, int **cts_io_num**);
uartSetPins uses that api but alls it with swapped CTS/RTS pins as its API uses a different pin ordering:
uart_set_pin(uart->num, txPin, rxPin, **ctsPin**, **rtsPin**);
This fixes the wrong order in the function uartSetPins
When building the core with `-Wextra` a few locations have `case:`
fall throughs or skipped field initializers.
Add proper comments for B64 cases to avoid GCC warnings
Initialized unused fields in Tone and WiFiGeneric to avoid missing
field initializer warnings.
````
2022-05-19T17:40:42.2280300Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/libb64/cdecode.c: In function 'base64_decode_block_signed':
2022-05-19T17:40:42.2282122Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/libb64/cdecode.c:42:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
2022-05-19T17:40:42.2283247Z *plainchar = (fragment & 0x03f) << 2;
2022-05-19T17:40:42.2284240Z ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
2022-05-19T17:40:42.2285087Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/libb64/cdecode.c:43:7: note: here
2022-05-19T17:40:42.2285435Z case step_b:
2022-05-19T17:40:42.2285691Z ^~~~
2022-05-19T17:40:42.2286515Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/libb64/cdecode.c:53:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
2022-05-19T17:40:42.2286932Z *plainchar = (fragment & 0x00f) << 4;
2022-05-19T17:40:42.2287219Z ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
2022-05-19T17:40:42.2287609Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/libb64/cdecode.c:54:7: note: here
2022-05-19T17:40:42.2287909Z case step_c:
2022-05-19T17:40:42.2288200Z ^~~~
2022-05-19T17:40:42.2288972Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/libb64/cdecode.c:64:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
2022-05-19T17:40:42.2289491Z *plainchar = (fragment & 0x003) << 6;
2022-05-19T17:40:42.2289745Z ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
2022-05-19T17:40:42.2290162Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/libb64/cdecode.c:65:7: note: here
2022-05-19T17:40:42.2290509Z case step_d:
2022-05-19T17:40:42.2290714Z ^~~~
2022-05-19T17:40:42.2482744Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/libb64/cencode.c: In function 'base64_encode_block':
2022-05-19T17:40:42.2484713Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/libb64/cencode.c:46:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
2022-05-19T17:40:42.2485415Z result = (fragment & 0x003) << 4;
2022-05-19T17:40:42.2486713Z ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
2022-05-19T17:40:42.2487696Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/libb64/cencode.c:47:9: note: here
2022-05-19T17:40:42.2488519Z case step_B:
2022-05-19T17:40:42.2489175Z ^~~~
2022-05-19T17:40:42.2492458Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/libb64/cencode.c:56:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
2022-05-19T17:40:42.2493351Z result = (fragment & 0x00f) << 2;
2022-05-19T17:40:42.2494227Z ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
2022-05-19T17:40:42.2496324Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/libb64/cencode.c:57:9: note: here
2022-05-19T17:40:42.2496937Z case step_C:
2022-05-19T17:40:42.2497261Z ^~~~
2022-05-19T17:40:44.6354962Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/Tone.cpp: In function 'void setToneChannel(uint8_t)':
2022-05-19T17:40:44.6356417Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/Tone.cpp:99:5: warning: missing initializer for member 'tone_msg_t::pin' [-Wmissing-field-initializers]
2022-05-19T17:40:44.6357120Z };
2022-05-19T17:40:44.6358732Z ^
2022-05-19T17:40:44.6364470Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/Tone.cpp:99:5: warning: missing initializer for member 'tone_msg_t::frequency' [-Wmissing-field-initializers]
2022-05-19T17:40:44.6367914Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/Tone.cpp:99:5: warning: missing initializer for member 'tone_msg_t::duration' [-Wmissing-field-initializers]
2022-05-19T17:40:44.6372875Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/Tone.cpp: In function 'void noTone(uint8_t)':
2022-05-19T17:40:44.6373943Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/Tone.cpp:110:5: warning: missing initializer for member 'tone_msg_t::frequency' [-Wmissing-field-initializers]
2022-05-19T17:40:44.6375154Z };
2022-05-19T17:40:44.6375825Z ^
2022-05-19T17:40:44.6379852Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/Tone.cpp:110:5: warning: missing initializer for member 'tone_msg_t::duration' [-Wmissing-field-initializers]
2022-05-19T17:40:44.6383291Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/Tone.cpp:110:5: warning: missing initializer for member 'tone_msg_t::channel' [-Wmissing-field-initializers]
2022-05-19T17:40:44.6388688Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/Tone.cpp: In function 'void tone(uint8_t, unsigned int, long unsigned int)':
2022-05-19T17:40:44.6389829Z /home/runner/arduino_ide/hardware/espressif/esp32/cores/esp32/Tone.cpp:128:5: warning: missing initializer for member 'tone_msg_t::channel' [-Wmissing-field-initializers]
2022-05-19T17:40:44.6390677Z };
2022-05-19T17:40:44.6391420Z ^
2022-05-19T17:42:00.6768353Z /home/runner/arduino_ide/hardware/espressif/esp32/libraries/WiFi/src/WiFiGeneric.cpp: In static member function 'static bool WiFiGenericClass::setDualAntennaConfig(uint8_t, uint8_t, wifi_rx_ant_t, wifi_tx_ant_t)':
2022-05-19T17:42:00.6769293Z /home/runner/arduino_ide/hardware/espressif/esp32/libraries/WiFi/src/WiFiGeneric.cpp:1333:5: warning: missing initializer for member 'wifi_ant_config_t::rx_ant_default' [-Wmissing-field-initializers]
2022-05-19T17:42:00.6769658Z };
2022-05-19T17:42:00.6769824Z ^
````
Fixed channel / unit selection for ESP32C3 (has only 5 channels on 1 adc unit).
Removed unnecessary includes.
Fixed different attenuation on channels to be taken in care in __analogReadMilliVolt.
All chips in __analogReadMilliVolts now use adc characteristics + calculation from raw to voltage as ESP32 does.
* Adjustable Serial Event Task Stack Size And Priority
* Added options to Kconfig
* Added Core Affinity
* Added CONFIG_FREERTOS_UNICORE
* Removed _CONFIG from FREERTOS_UNICORE
* Fixing Core choice for OnReceive()
Makes it alligned to changes in #6718
Also eliminates conflict with #6718 for merging
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
* fix(hal.cpu) compiler warn about printf-format for pointers >
warning was:
```
framework-arduinoespressif32/cores/esp32/esp32-hal-cpu.c:132:9: note: in expansion of macro 'log_e'
log_e("not found func=%08X arg=%08X",cb,arg);
^~~~~
framework-arduinoespressif32/tools/sdk/esp32/include/log/include/esp_log.h:276:27: warning: format '%X' expects argument of type 'unsigned int', but argument 7 has type 'void *' [-Wformat=]
```
* fix(tone.cpp) compiler warn about printf-format for pointers >
format-str expected plain uint while `duration` is long-uint.
Warning was:
```
.../cores/esp32/esp32-hal-log.h:115:32: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL'
#define log_d(format, ...) do {ESP_LOG_LEVEL_LOCAL(ESP_LOG_DEBUG, TAG, format, ##__VA_ARGS__);}while(0)
^~~~~~~~~~~~~~~~~~~
.../cores/esp32/Tone.cpp:31:9: note: in expansion of macro 'log_d'
log_d("Task received from queue TONE_START: _pin=%d, frequency=%u Hz, duration=%u ms", tone_msg.pin, tone_msg.frequency, tone_msg.duration);
^~~~~
.../tools/sdk/esp32/include/log/include/esp_log.h:276:27: warning: format '%u' expects argument of type 'unsigned int', but argument 8 has type 'long unsigned int' [-Wformat=]
```
Summary
Added compiler.warning_flags to all chips in platform.txt to reflect users setting of warning level output during compilation (set up in Arduino IDE preferences)
Impact
When a warning is set to none the compilation will no longer display warnings
Related links
Solves issue #6118
* Changed in pinMode() default intr_type
pins default configuration has intr_type = GPIO_INTR_DISABLE
With this implementation, it will set the intr_type to previously set intr_type. It will no longer disable interrupt, when pinmode is called multiple times on same pin with interrupt enabled.
Description of Change
Fixes IPAddress INADDR_NONE declaration when using Arduino WiFi or ETH.
This symbol was defined as 0xffffffff by lwip /inet.h, making it impossible to use INADDR_NONE correctly.
This PR only works when <wifi-provisioning/wifi_config.h> has a modification to include <lwip/ip4_addr.h> instead of <lwip/inet.h>. This will be done directly to the sdk folder in the github structure and it has been fixed in IDF by a separated Merge Request. This will be reflected in the future, for good.
Tests scenarios
This PR was tested with all Arduino WiFi examples, including AsyncUDP. Also with ETH examples.
It was also tested for #6610 test cases.
Testing done for ESP32, ESP32-S2, ESP32-C3 and ESP32-S3.
Related links
fixes#6610fixes#6247fixes#4732
by converting result log-rows from the 1st line to the 2nd (`NET` is the tag):
```
[ 73419][D][telelogger.cpp:915] telemetry(): state: 33C
[ 73419][D][telelogger.cpp:915] telemetry(): [NET] state: 33C
```
Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
* Adds HardwareSerial::onReceiveTimeout()
* Fixed typo
* Changes requested
* Fix eventQueueReset
* Changed _onReceiveTimeout to _rxTimeout for consistency
* Uniform uart_set_rx_timeout condition
* test _uart not NULL in eventQueueReset()
check if _uart is not NULL before using it.
* revert last commit - no need for it
reverting last change made - it is not necessary.
* adds onReceive() parameter
In order to allow the user to choose if onReceive() call back will be called only when UART Rx timeout happens or also when UART FIFO gets 120 bytes,
a new parameter has been added to onReceive() with the default behavior based on timeout.
void onReceive(OnReceiveCb function, bool onlyOnTimeout = true);
onReceive will setup a callback that will be called whenever an UART interruption occurs (UART_INTR_RXFIFO_FULL or UART_INTR_RXFIFO_TOUT)
UART_INTR_RXFIFO_FULL interrupt triggers at UART_FULL_THRESH_DEFAULT bytes received (defined as 120 bytes by default in IDF)
UART_INTR_RXFIFO_TOUT interrupt triggers at UART_TOUT_THRESH_DEFAULT symbols passed without any reception (defined as 10 symbos by default in IDF)
onlyOnTimeout parameter will define how onReceive will behave:
Default: true -- The callback will only be called when RX Timeout happens.
Whole stream of bytes will be ready for being read on the callback function at once.
This option may lead to Rx Overflow depending on the Rx Buffer Size and number of bytes received in the streaming
false -- The callback will be called when FIFO reaches 120 bytes and also on RX Timeout.
The stream of incommig bytes will be "split" into blocks of 120 bytes on each callback.
This option avoid any sort of Rx Overflow, but leaves the UART packet reassembling work to the Application.
* Adds onReceive() parameter for timeout only
* Adds back setRxTimeout()
* Adds setRxTimeout()
* CI Syntax error - "," missing
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>