1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +01:00

Reverted begin(long speed) to its original prototype (i.e.

returning void)
This commit is contained in:
sebastienjean 2012-12-02 17:22:59 +01:00
parent 369aeeef51
commit 9554c1d3cd
2 changed files with 3 additions and 8 deletions

View File

@ -376,15 +376,13 @@ void SoftwareSerial::setRX(uint8_t rx)
// Public methods // Public methods
// //
bool SoftwareSerial::begin(long speed) void SoftwareSerial::begin(long speed)
{ {
_rx_delay_centering = _rx_delay_intrabit = _rx_delay_stopbit = _tx_delay = 0; _rx_delay_centering = _rx_delay_intrabit = _rx_delay_stopbit = _tx_delay = 0;
long baud = 0;
for (unsigned i=0; i<sizeof(table)/sizeof(table[0]); ++i) for (unsigned i=0; i<sizeof(table)/sizeof(table[0]); ++i)
{ {
baud = pgm_read_dword(&table[i].baud); long baud = pgm_read_dword(&table[i].baud);
if (baud == speed) if (baud == speed)
{ {
_rx_delay_centering = pgm_read_word(&table[i].rx_delay_centering); _rx_delay_centering = pgm_read_word(&table[i].rx_delay_centering);
@ -394,7 +392,6 @@ bool SoftwareSerial::begin(long speed)
break; break;
} }
} }
if (baud != speed) return false;
// Set up RX interrupts, but only if we have a valid RX baud rate // Set up RX interrupts, but only if we have a valid RX baud rate
if (_rx_delay_stopbit) if (_rx_delay_stopbit)
@ -413,8 +410,6 @@ bool SoftwareSerial::begin(long speed)
#endif #endif
listen(); listen();
return true;
} }
void SoftwareSerial::end() void SoftwareSerial::end()

View File

@ -82,7 +82,7 @@ public:
// public methods // public methods
SoftwareSerial(uint8_t receivePin, uint8_t transmitPin, bool inverse_logic = false); SoftwareSerial(uint8_t receivePin, uint8_t transmitPin, bool inverse_logic = false);
~SoftwareSerial(); ~SoftwareSerial();
bool begin(long speed); void begin(long speed);
bool listen(); bool listen();
void end(); void end();
bool isListening() { return this == active_object; } bool isListening() { return this == active_object; }