You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code for HardwareSerial.cpp contains a goto statement which is not needed by rewriting the code.
This GOTO is in void HardwareSerial::begin(unsigned long baud)
proposed alternative :
voidHardwareSerial::begin(unsignedlong baud)
{
*_ucsra = 1 << _u2x;
uint16_t baud_setting = (F_CPU / 4 / baud - 1) / 2;
// hardcoded exception for compatibility with the bootloader shipped// with the Duemilanove and previous boards and the firmware on the 8U2// on the Uno and Mega 2560.if (((F_CPU == 16000000UL) && (baud == 57600)) || (baud_setting >4095))
{
*_ucsra = 0;
baud_setting = (F_CPU / 8 / baud - 1) / 2;
}
// assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register)
*_ubrrh = baud_setting >> 8;
*_ubrrl = baud_setting;
transmitting = false;
sbi(*_ucsrb, _rxen);
sbi(*_ucsrb, _txen);
sbi(*_ucsrb, _rxcie);
cbi(*_ucsrb, _udrie);
}
idem for - void HardwareSerial::begin(unsigned long baud, byte config) -
This simplifies the baud rate calculation, removing the need for a goto
and shortening the code a bit. Other than that, this code should not use
any different settings than before.
Code was suggested by Rob Tillaart on github.
Closes: arduino#1262
This simplifies the baud rate calculation, removing the need for a goto
and shortening the code a bit. Other than that, this code should not use
any different settings than before.
Code was suggested by Rob Tillaart on github.
Closes: arduino#1262
cmaglie
pushed a commit
to cmaglie/Arduino
that referenced
this issue
Jan 20, 2014
This simplifies the baud rate calculation, removing the need for a goto
and shortening the code a bit. Other than that, this code should not use
any different settings than before.
Code was suggested by Rob Tillaart on github.
Closes: arduino#1262
The code for HardwareSerial.cpp contains a goto statement which is not needed by rewriting the code.
This GOTO is in void HardwareSerial::begin(unsigned long baud)
proposed alternative :
idem for - void HardwareSerial::begin(unsigned long baud, byte config) -
Detailed discussion see - http://arduino.cc/forum/index.php/topic,146683.0.html
The text was updated successfully, but these errors were encountered: