From e7069da7eb41c8af6801b1404acd81d745eb8b83 Mon Sep 17 00:00:00 2001 From: Jan Dümpelmann Date: Wed, 18 Nov 2020 09:47:39 +0100 Subject: Reset CDC examples to original state --- examples/device/cdc_msc/src/main.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'examples/device/cdc_msc/src/main.c') diff --git a/examples/device/cdc_msc/src/main.c b/examples/device/cdc_msc/src/main.c index bcf05eaac..a407e2ddd 100644 --- a/examples/device/cdc_msc/src/main.c +++ b/examples/device/cdc_msc/src/main.c @@ -105,31 +105,34 @@ void tud_resume_cb(void) //--------------------------------------------------------------------+ void cdc_task(void) { - // is data available to read from rx fifo - if ( tud_cdc_available() ) + if ( tud_cdc_connected() ) { - uint8_t buf[64]; + // connected and there are data available + if ( tud_cdc_available() ) + { + uint8_t buf[64]; - // read and echo back - uint32_t count = tud_cdc_read(buf, sizeof(buf)); + // read and echo back + uint32_t count = tud_cdc_read(buf, sizeof(buf)); - for(uint32_t i=0; i