@@ -388,14 +388,14 @@ void tx_thread_fun(USBCDC *usb_cdc)
388
388
}
389
389
}
390
390
391
- void tx_ticker_fun (USBCDC *usb_cdc, uint8_t start_val)
391
+ void tx_ticker_fun (USBCDC *usb_cdc, uint8_t start_val, uint8_t size = TX_BUFF_SIZE )
392
392
{
393
393
static uint8_t buff_val = start_val;
394
+ uint32_t actual_tx = 0 ;
394
395
uint8_t buff[TX_BUFF_SIZE] = { 0 };
395
- memset (buff, buff_val, TX_BUFF_SIZE);
396
- while (usb_cdc->send (buff, TX_BUFF_SIZE)) {
397
- break ;
398
- }
396
+ memset (buff, buff_val, size);
397
+ usb_cdc->send_nb (buff, size, &actual_tx);
398
+ TEST_ASSERT_EQUAL_UINT8 (size, actual_tx);
399
399
buff_val++;
400
400
}
401
401
@@ -422,7 +422,7 @@ void test_cdc_rx_single_bytes_concurrent()
422
422
tx_thread.start (mbed::callback (tx_thread_fun, &usb_cdc));
423
423
#else
424
424
Ticker t;
425
- t.attach ([&] { tx_ticker_fun (&usb_cdc, 0 ); }, 3ms );
425
+ t.attach ([&] { tx_ticker_fun (&usb_cdc, 0 , 1 ); }, 2ms );
426
426
#endif
427
427
428
428
uint8_t buff = 0x01 ;
@@ -434,9 +434,12 @@ void test_cdc_rx_single_bytes_concurrent()
434
434
TEST_ASSERT (usb_cdc.receive (&buff, 1 , NULL ));
435
435
TEST_ASSERT_EQUAL_UINT8 (expected, buff);
436
436
}
437
- event_flags. clear (EF_SEND);
437
+
438
438
#if defined(MBED_CONF_RTOS_PRESENT)
439
+ event_flags.clear (EF_SEND);
439
440
tx_thread.join ();
441
+ #else
442
+ t.detach ();
440
443
#endif
441
444
// Wait for the host to close its port.
442
445
while (usb_cdc.ready ()) {
0 commit comments