HardwareSerial - add changeBaudRate method (#2223)

* Add updateBaudRate to hardware serial

* remove flush

* Fix tab
This commit is contained in:
Tomasz Ścisłowicz 2018-12-23 20:15:06 +01:00 committed by Me No Dev
parent 4f9a90fa0e
commit 5af139bb74
2 changed files with 6 additions and 0 deletions

View File

@ -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() void HardwareSerial::end()
{ {
if(uartGetDebug() == _uart_nr) { if(uartGetDebug() == _uart_nr) {

View File

@ -57,6 +57,7 @@ public:
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 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 end();
void updateBaudRate(unsigned long baud);
int available(void); int available(void);
int availableForWrite(void); int availableForWrite(void);
int peek(void); int peek(void);