1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

Function added to detect baudrate (#4978)

* Function added to detect baudrate

* Added uart_start_detect_baudrate, detectBaudrate() wrappers for HardwareSerial and an example usage SerialDetectBaudrate.ino

* Some layout changes to pass Travis tests

* Some more nitty-gritty layout changes to pass Travis tests

* Some even more nitty-gritty layout changes to pass Travis tests

* renamed one function to testBaudrate() and updated doc/reference.rst

* Minor updates to doc/reference.rst

* New lines added
This commit is contained in:
Jeroen88
2018-08-01 21:33:25 +02:00
committed by Develo
parent 3ab38d690d
commit e4d9c279ef
6 changed files with 125 additions and 0 deletions

View File

@ -155,6 +155,17 @@ current speed. For example
| Note that this implementation is **only for ESP8266 based boards**,
and will not works with other Arduino boards.
To detect an unknown baudrate of data coming into Serial use ``Serial.detectBaudrate(time_t timeoutMillis)``. This method tries to detect the baudrate for a maximum of timeoutMillis ms. It returns zero if no baudrate was detected, or the detected baudrate otherwise. The ``detectBaudrate()`` function may be called before ``Serial.begin()`` is called, because it does not need the receive buffer nor the SerialConfig parameters.
The uart can not detect other parameters like number of start- or stopbits, number of data bits or parity.
The detection itself does not change the baudrate, after detection it should be set as usual using ``Serial.begin(detectedBaudrate)``.
Detection is very fast, it takes only a few incoming bytes.
SerialDetectBaudrate.ino is a full example of usage.
Progmem
-------