Remove tud_cdc_connected check from examples

This commit is contained in:
Jan Dümpelmann
2020-09-04 17:25:32 +02:00
parent 9cc22b635c
commit e09ebea7b9
3 changed files with 34 additions and 43 deletions

View File

@@ -83,18 +83,15 @@ static void cdc_task(void)
for (itf = 0; itf < CFG_TUD_CDC; itf++)
{
if ( tud_cdc_n_connected(itf) )
if ( tud_cdc_n_available(itf) )
{
if ( tud_cdc_n_available(itf) )
{
uint8_t buf[64];
uint8_t buf[64];
uint32_t count = tud_cdc_n_read(itf, buf, sizeof(buf));
uint32_t count = tud_cdc_n_read(itf, buf, sizeof(buf));
// echo back to both serial ports
echo_serial_port(0, buf, count);
echo_serial_port(1, buf, count);
}
// echo back to both serial ports
echo_serial_port(0, buf, count);
echo_serial_port(1, buf, count);
}
}
}