|
|
|
@ -148,14 +148,16 @@ void UARTDriver::begin(uint32_t b, uint16_t rxS, uint16_t txS)
@@ -148,14 +148,16 @@ void UARTDriver::begin(uint32_t b, uint16_t rxS, uint16_t txS)
|
|
|
|
|
thrashing of the heap once we are up. The ttyACM0 driver may not |
|
|
|
|
connect for some time after boot |
|
|
|
|
*/ |
|
|
|
|
if (rxS != _readbuf.get_size()) { |
|
|
|
|
_initialised = false; |
|
|
|
|
while (_in_timer) { |
|
|
|
|
hal.scheduler->delay(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (rxS != _readbuf.get_size()) { |
|
|
|
|
_initialised = false; |
|
|
|
|
_readbuf.set_size(rxS); |
|
|
|
|
} |
|
|
|
|
if (hal.console != this) { // don't clear USB buffers (allows early startup messages to escape)
|
|
|
|
|
_readbuf.clear(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (b != 0) { |
|
|
|
|
_baudrate = b; |
|
|
|
@ -173,13 +175,16 @@ void UARTDriver::begin(uint32_t b, uint16_t rxS, uint16_t txS)
@@ -173,13 +175,16 @@ void UARTDriver::begin(uint32_t b, uint16_t rxS, uint16_t txS)
|
|
|
|
|
/*
|
|
|
|
|
allocate the write buffer |
|
|
|
|
*/ |
|
|
|
|
if (txS != _writebuf.get_size()) { |
|
|
|
|
_initialised = false; |
|
|
|
|
while (_in_timer) { |
|
|
|
|
hal.scheduler->delay(1); |
|
|
|
|
} |
|
|
|
|
if (txS != _writebuf.get_size()) { |
|
|
|
|
_initialised = false; |
|
|
|
|
_writebuf.set_size(txS); |
|
|
|
|
} |
|
|
|
|
if (hal.console != this) { // don't clear USB buffers (allows early startup messages to escape)
|
|
|
|
|
_writebuf.clear(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (sdef.is_usb) { |
|
|
|
|
#ifdef HAVE_USB_SERIAL |
|
|
|
|