File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -239,7 +239,7 @@ void SerialUART::begin(unsigned long baud, uint16_t config) {
239239 gpio_set_inover (_cts, _invertControl ? 1 : 0 );
240240 }
241241
242- int achieved_baud = uart_init (_uart, baud);
242+ _achievedBaud = uart_init (_uart, baud);
243243 int bits, stop;
244244 uart_parity_t parity;
245245 switch (config & SERIAL_PARITY_MASK) {
@@ -295,7 +295,6 @@ void SerialUART::begin(unsigned long baud, uint16_t config) {
295295 }
296296 _break = false ;
297297 _running = true ;
298- return achieved_baud;
299298}
300299
301300void SerialUART::end () {
Original file line number Diff line number Diff line change @@ -64,10 +64,10 @@ class SerialUART : public arduino::HardwareSerial {
6464 bool setFIFOSize (size_t size);
6565 bool setPollingMode (bool mode = true );
6666
67- int begin (unsigned long baud = 115200 ) override {
67+ void begin (unsigned long baud = 115200 ) override {
6868 return begin (baud, SERIAL_8N1);
6969 };
70- int begin (unsigned long baud, uint16_t config) override ;
70+ void begin (unsigned long baud, uint16_t config) override ;
7171 void end () override ;
7272
7373 virtual int peek () override ;
@@ -93,13 +93,19 @@ class SerialUART : public arduino::HardwareSerial {
9393 // on read)
9494 bool getBreakReceived ();
9595
96+ // Returns the baud rate the uart is actually operating at vs the desired baud rate specified to begin()
97+ int getAcheivedBaud () {
98+ return _achievedBaud;
99+ }
100+
96101private:
97102 bool _running = false ;
98103 uart_inst_t *_uart;
99104 pin_size_t _tx, _rx;
100105 pin_size_t _rts, _cts;
101106 gpio_function_t _fcnTx, _fcnRx, _fcnRts, _fcnCts;
102107 int _baud;
108+ int _achievedBaud;
103109 mutex_t _mutex;
104110 bool _polling = false ;
105111 bool _overflow;
You can’t perform that action at this time.
0 commit comments