Skip to content

Commit 5af139b

Browse files
toomaszme-no-dev
authored andcommitted
HardwareSerial - add changeBaudRate method (#2223)
* Add updateBaudRate to hardware serial * remove flush * Fix tab
1 parent 4f9a90f commit 5af139b

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Diff for: cores/esp32/HardwareSerial.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
7373
}
7474
}
7575

76+
void HardwareSerial::updateBaudRate(unsigned long baud)
77+
{
78+
uartSetBaudRate(_uart, baud);
79+
}
80+
7681
void HardwareSerial::end()
7782
{
7883
if(uartGetDebug() == _uart_nr) {

Diff for: cores/esp32/HardwareSerial.h

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class HardwareSerial: public Stream
5757

5858
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);
5959
void end();
60+
void updateBaudRate(unsigned long baud);
6061
int available(void);
6162
int availableForWrite(void);
6263
int peek(void);

0 commit comments

Comments
 (0)