@@ -388,14 +388,14 @@ void tx_thread_fun(USBCDC *usb_cdc)
388388 }
389389}
390390
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 )
392392{
393393 static uint8_t buff_val = start_val;
394+ uint32_t actual_tx = 0 ;
394395 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);
399399 buff_val++;
400400}
401401
@@ -422,7 +422,7 @@ void test_cdc_rx_single_bytes_concurrent()
422422 tx_thread.start (mbed::callback (tx_thread_fun, &usb_cdc));
423423#else
424424 Ticker t;
425- t.attach ([&] { tx_ticker_fun (&usb_cdc, 0 ); }, 3ms );
425+ t.attach ([&] { tx_ticker_fun (&usb_cdc, 0 , 1 ); }, 2ms );
426426#endif
427427
428428 uint8_t buff = 0x01 ;
@@ -434,9 +434,12 @@ void test_cdc_rx_single_bytes_concurrent()
434434 TEST_ASSERT (usb_cdc.receive (&buff, 1 , NULL ));
435435 TEST_ASSERT_EQUAL_UINT8 (expected, buff);
436436 }
437- event_flags. clear (EF_SEND);
437+
438438#if defined(MBED_CONF_RTOS_PRESENT)
439+ event_flags.clear (EF_SEND);
439440 tx_thread.join ();
441+ #else
442+ t.detach ();
440443#endif
441444 // Wait for the host to close its port.
442445 while (usb_cdc.ready ()) {
0 commit comments