Skip to content

Commit 3d78af9

Browse files
ci(pre-commit): Apply automatic fixes
1 parent d17034e commit 3d78af9

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

docs/en/api/serial.rst

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ ESP32-H2 2 0
4141
ESP32-P4 5 1
4242
========= ======== ========
4343

44-
**Note:**
44+
**Note:**
4545
* HP (High-Performance) UARTs are the standard UART peripherals
4646
* LP (Low-Power) UARTs are available on some SoCs for ultra-low power applications
4747
* UART0 is typically used for programming and debug output (Serial Monitor)
4848
* Additional UARTs (Serial1, Serial2, etc.) are available for general-purpose communication, including LP UARTs when available. The ESP32 Arduino Core automatically creates HardwareSerial objects for all available UARTs:
49-
49+
5050
* ``Serial0`` (or ``Serial``) - UART0 (HP UART, typically used for programming and debug output)
5151
* ``Serial1``, ``Serial2``, etc. - Additional HP UARTs (numbered sequentially)
5252
* Additional Serial objects - LP UARTs, when available (numbered after HP UARTs)
53-
53+
5454
**Example:** The ESP32-C6 has 2 HP UARTs and 1 LP UART. The Arduino Core creates ``Serial0`` and ``Serial1`` (HP UARTs) plus ``Serial2`` (LP UART) HardwareSerial objects.
55-
55+
5656
**Important:** LP UARTs can be used as regular UART ports, but they have fixed GPIO pins for RX, TX, CTS, and RTS. It is not possible to change the pins for LP UARTs using ``setPins()``.
5757

5858
Arduino-ESP32 Serial API
@@ -68,10 +68,10 @@ Initializes the Serial port with the specified baud rate and configuration.
6868
void begin(unsigned long baud, uint32_t config = SERIAL_8N1, int8_t rxPin = -1, int8_t txPin = -1, bool invert = false, unsigned long timeout_ms = 20000UL, uint8_t rxfifo_full_thrhd = 120);
6969
7070
* ``baud`` - Baud rate (bits per second). Common values: 9600, 115200, 230400, etc.
71-
71+
7272
**Special value:** ``0`` enables baud rate detection (ESP32, ESP32-S2 only). The function will attempt to detect the baud rate for up to ``timeout_ms`` milliseconds. See the :ref:`Baud Rate Detection Example <baud-rate-detection-example>` for usage details.
7373
* ``config`` - Serial configuration (data bits, parity, stop bits):
74-
74+
7575
* ``SERIAL_8N1`` - 8 data bits, no parity, 1 stop bit (default)
7676
* ``SERIAL_8N2`` - 8 data bits, no parity, 2 stop bits
7777
* ``SERIAL_8E1`` - 8 data bits, even parity, 1 stop bit
@@ -98,10 +98,10 @@ Initializes the Serial port with the specified baud rate and configuration.
9898
9999
// Basic initialization with default pins
100100
Serial.begin(115200);
101-
101+
102102
// Initialize with custom pins
103103
Serial1.begin(9600, SERIAL_8N1, 4, 5);
104-
104+
105105
// Initialize with baud rate detection (ESP32, ESP32-S2 only)
106106
Serial.begin(0, SERIAL_8N1, -1, -1, false, 20000);
107107
@@ -349,15 +349,15 @@ Sets the RX timeout threshold in UART symbol periods.
349349
bool setRxTimeout(uint8_t symbols_timeout);
350350
351351
* ``symbols_timeout`` - Timeout threshold in UART symbol periods. Setting ``0`` disables timeout-based callbacks.
352-
352+
353353
The timeout is calculated based on the current baud rate and serial configuration. For example:
354-
354+
355355
* For ``SERIAL_8N1`` (10 bits per symbol), a timeout of 3 symbols at 9600 baud = 3 / (9600 / 10) = 3.125 ms
356356
* Maximum timeout is calculated automatically by ESP-IDF based on the serial configuration
357357

358358
**Returns:** ``true`` if timeout is set successfully, ``false`` otherwise.
359359

360-
**Note:**
360+
**Note:**
361361
* When RX timeout occurs, the ``onReceive()`` callback is triggered
362362
* For ESP32 and ESP32-S2, when using REF_TICK clock source (baud rates ≤ 250000), RX timeout is limited to 1 symbol
363363
* To use higher RX timeout values on ESP32/ESP32-S2, set the clock source to APB using ``setClockSource(UART_CLK_SRC_APB)`` before ``begin()``
@@ -372,12 +372,12 @@ Sets the RX FIFO full threshold that triggers data transfer from FIFO to RX buff
372372
bool setRxFIFOFull(uint8_t fifoBytes);
373373
374374
* ``fifoBytes`` - Number of bytes (1-127) that will trigger the FIFO full interrupt
375-
375+
376376
When the UART FIFO reaches this threshold, data is copied to the RX buffer and the ``onReceive()`` callback is triggered.
377377

378378
**Returns:** ``true`` if threshold is set successfully, ``false`` otherwise.
379379

380-
**Note:**
380+
**Note:**
381381
* Lower values (e.g., 1) provide byte-by-byte reception but consume more CPU time
382382
* Higher values (e.g., 120) provide better performance but introduce latency
383383
* Default value depends on baud rate: 1 byte for ≤ 115200 baud, 120 bytes for > 115200 baud
@@ -416,7 +416,7 @@ Sets a callback function that is called when data is received.
416416
Serial.print(c);
417417
}
418418
}
419-
419+
420420
void setup() {
421421
Serial1.begin(115200);
422422
Serial1.onReceive(onReceiveCallback);
@@ -455,7 +455,7 @@ Sets a callback function that is called when a UART error occurs.
455455
void onErrorCallback(hardwareSerial_error_t error) {
456456
Serial.printf("UART Error: %d\n", error);
457457
}
458-
458+
459459
void setup() {
460460
Serial1.begin(115200);
461461
Serial1.onReceiveError(onErrorCallback);
@@ -482,7 +482,7 @@ Enables or disables hardware flow control using RTS and/or CTS pins.
482482
bool setHwFlowCtrlMode(SerialHwFlowCtrl mode = UART_HW_FLOWCTRL_CTS_RTS, uint8_t threshold = 64);
483483
484484
* ``mode`` - Hardware flow control mode:
485-
485+
486486
* ``UART_HW_FLOWCTRL_DISABLE`` (0x0) - Disable hardware flow control
487487
* ``UART_HW_FLOWCTRL_RTS`` (0x1) - Enable RX hardware flow control (RTS)
488488
* ``UART_HW_FLOWCTRL_CTS`` (0x2) - Enable TX hardware flow control (CTS)
@@ -504,7 +504,7 @@ Sets the UART operating mode.
504504
bool setMode(SerialMode mode);
505505
506506
* ``mode`` - UART mode:
507-
507+
508508
* ``UART_MODE_UART`` (0x00) - Regular UART mode (default)
509509
* ``UART_MODE_RS485_HALF_DUPLEX`` (0x01) - Half-duplex RS485 mode (RTS pin controls transceiver)
510510
* ``UART_MODE_IRDA`` (0x02) - IRDA UART mode
@@ -525,7 +525,7 @@ Sets the UART clock source. Must be called **before** ``begin()`` to take effect
525525
bool setClockSource(SerialClkSrc clkSrc);
526526
527527
* ``clkSrc`` - Clock source:
528-
528+
529529
* ``UART_CLK_SRC_DEFAULT`` - Default clock source (varies by SoC)
530530
* ``UART_CLK_SRC_APB`` - APB clock (ESP32, ESP32-S2, ESP32-C3, ESP32-S3)
531531
* ``UART_CLK_SRC_PLL`` - PLL clock (ESP32-C2, ESP32-C5, ESP32-C6, ESP32-C61, ESP32-H2, ESP32-P4)
@@ -665,4 +665,3 @@ RS485 Communication Example:
665665
:language: arduino
666666

667667
Complete list of `Serial examples <https://github.com/espressif/arduino-esp32/tree/master/libraries/ESP32/examples/Serial>`_.
668-

0 commit comments

Comments
 (0)