Skip to content

Commit

Permalink
HardwareSerial - add changeBaudRate method (#2223)
Browse files Browse the repository at this point in the history
* Add updateBaudRate to hardware serial

* remove flush

* Fix tab
  • Loading branch information
toomasz authored and me-no-dev committed Dec 23, 2018
1 parent 4f9a90f commit 5af139b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cores/esp32/HardwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
}
}

void HardwareSerial::updateBaudRate(unsigned long baud)
{
uartSetBaudRate(_uart, baud);
}

void HardwareSerial::end()
{
if(uartGetDebug() == _uart_nr) {
Expand Down
1 change: 1 addition & 0 deletions cores/esp32/HardwareSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class HardwareSerial: public Stream

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);
void end();
void updateBaudRate(unsigned long baud);
int available(void);
int availableForWrite(void);
int peek(void);
Expand Down

0 comments on commit 5af139b

Please sign in to comment.