Skip to content

Commit 2b35a62

Browse files
committed
Add wait for serial characters to transmit before deleting serial object.
1 parent 722e897 commit 2b35a62

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

features/unsupported/tests/mbed/echo/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ int main() {
1515
MBED_HOSTTEST_SELECT(echo);
1616
MBED_HOSTTEST_DESCRIPTION(Serial Echo at 115200);
1717
MBED_HOSTTEST_START("MBED_A9");
18+
wait(0.5); // wait for characters to finish transmitting
1819

1920
Serial pc(TXPIN, RXPIN);
2021
pc.baud(115200);

features/unsupported/tests/mbed/serial_nc_rx/main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ int main() {
1515
// This should be true, sync the start of test
1616
if (c == 'S') {
1717
pc->printf("RX OK - Start NC test\r\n");
18+
wait(0.25); // wait for characters to finish transmitting
1819

1920
// disconnect TX and get char
2021
delete pc;
@@ -25,11 +26,13 @@ int main() {
2526
delete pc;
2627
pc = new Serial(USBTX, NC);
2728
pc->printf("RX OK - Expected\r\n");
29+
wait(0.25); // wait for characters to finish transmitting
2830

2931
c = pc->getc();
3032
// This should be false/not get here
3133
if (c == 'U') {
3234
pc->printf("RX OK - Unexpected\r\n");
35+
wait(0.25); // wait for characters to finish transmitting
3336
}
3437
}
3538
delete pc;

features/unsupported/tests/mbed/serial_nc_tx/main.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@ int main() {
1717
if (c == 'S') {
1818
Serial *pc = new Serial(USBTX, NC);
1919
pc->printf("TX OK - Expected\r\n");
20+
wait(0.5); // wait for characters to finish transmitting
21+
2022
delete pc;
2123

2224
pc = new Serial(NC, USBRX);
2325
pc->printf("TX OK - Unexpected\r\n");
26+
wait(0.5); // wait for characters to finish transmitting
2427
delete pc;
2528
}
2629

27-
28-
2930
while (1) {
3031
}
3132
}

0 commit comments

Comments
 (0)