Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cores/rp2040/SerialUART.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void SerialUART::begin(unsigned long baud, uint16_t config) {
gpio_set_inover(_cts, _invertControl ? 1 : 0);
}

uart_init(_uart, baud);
_actualBaud = uart_init(_uart, baud);
int bits, stop;
uart_parity_t parity;
switch (config & SERIAL_PARITY_MASK) {
Expand Down
6 changes: 6 additions & 0 deletions cores/rp2040/SerialUART.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,19 @@ class SerialUART : public arduino::HardwareSerial {
// on read)
bool getBreakReceived();

// Returns the baud rate the uart is actually operating at vs the desired baud rate specified to begin()
int getActualBaud() {
return _running ? _actualBaud : 0;
}

private:
bool _running = false;
uart_inst_t *_uart;
pin_size_t _tx, _rx;
pin_size_t _rts, _cts;
gpio_function_t _fcnTx, _fcnRx, _fcnRts, _fcnCts;
int _baud;
int _actualBaud;
mutex_t _mutex;
bool _polling = false;
bool _overflow;
Expand Down