Commit Graph

23 Commits

Author SHA1 Message Date
Dirk O. Kaar
f275ce5563
Use enum for C++ to avoid macro pitfalls (#7926) 2023-03-31 14:32:48 +03:00
Rodrigo Garcia
5dff15ce9d
Fixes inconsistencies and adds extended HardwareSerial examples (#7412)
* 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
2022-12-21 18:47:17 +02:00
Rodrigo Garcia
7cbd0371e4
Improves UART reading performance (#7525)
* Improves UART reading performance

* overrides Stream::readBytes()

* fixes override signature

* adds some IDF error return  conditions
2022-12-13 11:54:07 +02:00
Rodrigo Garcia
2cebee4a40
fixes UART pin detach on end() (#7402) 2022-11-02 12:30:02 +02:00
Rodrigo Garcia
dca1a1e6b3
Changes UART ISR to only trigger on RX FIFO Full and timeout (#6930)
* 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
2022-09-15 15:12:40 +03:00
Gonzalo Brusco
77e95311e0
Adds HardwareSerial::setTxBufferSize() (#6383)
* Adds HardwareSerial::setTxBufferSize()

* uartBegin def fix

* checks TXBufferSize  as defined in IDF

Makes sure that the buffer size will not cause a reset to the board.

* Removes double value in Rx/Tx Buffer Size 

Keeps Rx/Tx buffer size as set, not doubling it. It makes the process more clear.

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
2022-03-28 11:37:12 +03:00
Rodrigo Garcia
7d4992a811
Adds C++ std::function to Serial.onReceive() (#6364)
* Adds C++ std::function to Serial.onReceive()

* fixes LOCK macro when disabled
2022-03-02 15:20:43 +02:00
Rodrigo Garcia
50e9772ecf
Fixes UART pin setting + adds CTS/RTS HW Flow Control (#6272)
* fixes setPins and begin to keep rx/tx unmodified

* adds Hardware Flow Control mode and CTS/RTS pin setting

* adds Hardware Flow Control mode and CTS/RTS pin setting

* adds Hardware Flow Control mode and CTS/RTS pin setting

* adds Hardware Flow Control mode and CTS/RTS pin setting

* Code Review
2022-02-17 03:28:46 +02:00
Rodrigo Garcia
c014eaf352
Adds UART RX IRQ Callback with onReceive() (#6134)
* Adds UART RX IRQ Callback with onReceive()
2022-01-17 16:04:12 +02:00
Rodrigo Garcia
b1d072df9f
Implements UART SerialHardware Refactoring on top of IDF (#5549)
## Summary
This PR is a complete reffactoring of UART Serial Hardware and respective HAL in order to use IDF instead of current Register manipulation approach. 

It  implements Arduino SerialEvent functionality. 

Fix #5287  
Fix #5273 
Fix #5519 
Fix #5247 
Fix #5403
Fix #5429
Fix #5047
Fix #5463
Fix #5362 
Fix #5112  
Fix #5443 

## Impact
It solves many reported issues related to UART.
It was tested and works fine for ESP32, ESP-S2 and ESP32-C3.
2021-08-23 17:25:33 +03:00
me-no-dev
371f382db7 Fix Serial RX and add option for FIFO Full Threshold in Serial.begin
Fixes: https://github.com/espressif/arduino-esp32/issues/5005
2021-04-08 15:29:53 +03:00
me-no-dev
8dc70e0add Revert "Update licenses"
This reverts commit 4b3f5c8ed4.
2021-03-11 12:11:53 +02:00
me-no-dev
4b3f5c8ed4 Update licenses 2021-02-18 12:14:35 +02:00
brian-r-calder
8fcc914853
Added facility to invert the polarity of input UART bits. (#4200) 2020-10-01 13:58:48 +03:00
lbernstone
80418fadcf
Fixes UART detach. Fixes #3878 (#3894)
* Fixes UART detach.  Fixes #3878

* 0 is not a good holder value for pins!

* 0 is not a good holder value for pins!
2020-09-30 15:04:18 +03:00
chuck todd
7d2632c024 Implement Tx only Flush (#3433)
* add option to Flush() to only clear txQueue

Add the option to cause Flush() to just wait for tx data to clear the tx fifo and uart, leave the rx queue and rx fifo as is.

* support tx only flush()

* support tx only Flush()

* support txOnly for Flush()

* compatibility to Stream()

* compatibility for Stream()

* default value error

* default value error

* Update esp32-hal-uart.h

* Update esp32-hal-uart.c

* Update HardwareSerial.cpp

* sp

* correctly implement flushTxOnly()
2019-11-11 15:37:35 +01:00
Jeroen88
f71a4bd406 Bugfix/detect baudrate (#3188)
* Expose uartStartDetectBaudrate(uart_t *) in esp32-hal-uart.h and call it from HardwareSerial::begin() if baudrate detection is requested (by passing a baudrate of 0) to solve baudrate detection problems

* Avoid a division by zero error in uartGetBaudRate()
2019-09-09 00:59:32 +03:00
Mike Dunston
f3c1a91f8e adding uartRxActive to expose the RX state machine status as a boolean value (#2457) 2019-03-03 15:47:24 +01:00
Jeroen88
233d31bed2 Added baudrate detection to esp32-hal-uart and HardwareSerial (#1961)
* Added baudrate detection to esp32-hal-uart and HardwareSerial

* Solved compiler warning for uartResizeRxBuffer()

* Add unit to header variable name (timeout_ms)

* Reverting accidentally changed files to master

* Add small delay after baudrate detection
2018-11-19 16:51:55 +01:00
Adam Coddington
ce61074802 Add functionality allowing rxBuffer of HardwareSerial to be changed in size via HardwareSerial::setRxBufferSize. (#1855) 2018-09-17 21:16:18 +02:00
mtabu
aa1288aa6e HardwareSerial - availableForWrite() support (#1226)
* HardwareSerial - availableForWrite() support

* fix indentation errors (tab vs space)
2018-04-06 19:07:46 +03:00
me-no-dev
17c8ceb1b9 UART rework
many possible problems fixed in preparation for thread-safe
2016-10-14 03:02:40 +03:00
me-no-dev
5f3a205955 initial import 2016-10-06 07:09:44 -06:00