Skip to content

Commit b7fc7e1

Browse files
akasonafpistm
authored andcommitted
Add HardwareSerial flow control APIs
1 parent 0c362a4 commit b7fc7e1

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

API.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,33 @@ void loop() {
291291
292292
**Note:** Serial Rx/TX buffer size can be changed, see [custom definitions](https://github.com/stm32duino/wiki/wiki/Custom-definitions#serial-rxtx-buffer-size)
293293
294+
#### Enable hardware flow control
295+
296+
Available in core version **2.3.0** or later
297+
298+
* `HardwareSerial` constructors accept optional RTS/CTS pins:
299+
* `HardwareSerial(uint32_t _rx, uint32_t _tx, uint32_t _rts = NUM_DIGITAL_PINS, uint32_t _cts = NUM_DIGITAL_PINS)`
300+
* `HardwareSerial(PinName _rx, PinName _tx, PinName _rts = NC, PinName _cts = NC)`
301+
* You can also enable RTS/CTS pins on `HardwareSerial` instances:
302+
* `void setRts(uint32_t _rts)`
303+
* `void setCts(uint32_t _cts)`
304+
* `void setRtsCts(uint32_t _rts, uint32_t _cts)`
305+
* `void setRts(PinName _rts)`
306+
* `void setCts(PinName _cts)`
307+
* `void setRtsCts(PinName _rts, PinName _cts)`
308+
309+
##### Example:
310+
311+
```C++
312+
// Enable hardware flow control on construction.
313+
HardwareSerial serial(PA10, PA9, PA12, PA11);
314+
315+
// Or, enable later (but before calling begin()).
316+
HardwareSerial serial(PA10, PA9);
317+
serial.setRtsCts(PA12, PA11);
318+
serial.begin(460800);
319+
```
320+
294321
## HardwareTimer library
295322
https://github.com/stm32duino/wiki/wiki/HardwareTimer-library
296323

0 commit comments

Comments
 (0)