Skip to content

Commit 3514b44

Browse files
committed
Fix compialtion for targets without DEVICE_SERIAL_ASYNCH
ATTENTION: this breaks RX capabilities need to understand how to enable the buffered serial for every target
1 parent 1da499b commit 3514b44

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cores/arduino/Serial.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ void UART::begin(unsigned long baudrate) {
1515
if (_serial == NULL) {
1616
_serial = new mbed::Serial(tx, rx, baudrate);
1717
}
18+
#ifdef DEVICE_SERIAL_ASYNCH
1819
_serial->read(intermediate_buf, 1, mbed::callback(this, &UART::on_rx));
20+
#endif
1921
}
2022

2123
void UART::on_rx(int howmany) {
2224
rx_buffer.store_char(intermediate_buf[0]);
25+
#ifdef DEVICE_SERIAL_ASYNCH
2326
_serial->read(intermediate_buf, 1, mbed::callback(this, &UART::on_rx));
27+
#endif
2428
}
2529

2630
void UART::end() {
@@ -30,7 +34,6 @@ void UART::end() {
3034
}
3135

3236
int UART::available() {
33-
//on_rx();
3437
return rx_buffer.available();
3538
}
3639

0 commit comments

Comments
 (0)