summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2020-11-24 01:04:44 +0700
committerGitHub <[email protected]>2020-11-24 01:04:44 +0700
commit2bfcd446a58d987d2275774c985471198cf43328 (patch)
treecb6eee5f2dbb43258951f8aee102b93783c91e1b /examples
parentb870d932e5e1c6ece4227a5d49cc71e53a744149 (diff)
parent494e125432ca3eb6faa5de2896cfb8e2e7143ddb (diff)
Merge pull request #506 from duempel/cdc_without_dtr
CDC without DTR being set
Diffstat (limited to 'examples')
-rw-r--r--examples/device/cdc_dual_ports/src/main.c2
-rw-r--r--examples/device/cdc_msc/src/main.c8
-rw-r--r--examples/device/cdc_msc_freertos/src/main.c10
3 files changed, 15 insertions, 5 deletions
diff --git a/examples/device/cdc_dual_ports/src/main.c b/examples/device/cdc_dual_ports/src/main.c
index d6e38df85..198c4252b 100644
--- a/examples/device/cdc_dual_ports/src/main.c
+++ b/examples/device/cdc_dual_ports/src/main.c
@@ -83,6 +83,8 @@ static void cdc_task(void)
for (itf = 0; itf < CFG_TUD_CDC; itf++)
{
+ // connected() check for DTR bit
+ // Most but not all terminal client set this when making connection
if ( tud_cdc_n_connected(itf) )
{
if ( tud_cdc_n_available(itf) )
diff --git a/examples/device/cdc_msc/src/main.c b/examples/device/cdc_msc/src/main.c
index a407e2ddd..a20a80fcd 100644
--- a/examples/device/cdc_msc/src/main.c
+++ b/examples/device/cdc_msc/src/main.c
@@ -105,7 +105,9 @@ void tud_resume_cb(void)
//--------------------------------------------------------------------+
void cdc_task(void)
{
- if ( tud_cdc_connected() )
+ // connected() check for DTR bit
+ // Most but not all terminal client set this when making connection
+ // if ( tud_cdc_connected() )
{
// connected and there are data available
if ( tud_cdc_available() )
@@ -131,12 +133,14 @@ void cdc_task(void)
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
{
(void) itf;
+ (void) rts;
// connected
- if ( dtr && rts )
+ if ( dtr )
{
// print initial message when connected
tud_cdc_write_str("\r\nTinyUSB CDC MSC device example\r\n");
+ tud_cdc_write_flush();
}
}
diff --git a/examples/device/cdc_msc_freertos/src/main.c b/examples/device/cdc_msc_freertos/src/main.c
index 1371b84c3..e90c3f0d9 100644
--- a/examples/device/cdc_msc_freertos/src/main.c
+++ b/examples/device/cdc_msc_freertos/src/main.c
@@ -168,9 +168,11 @@ void cdc_task(void* params)
// RTOS forever loop
while ( 1 )
{
- if ( tud_cdc_connected() )
+ // connected() check for DTR bit
+ // Most but not all terminal client set this when making connection
+ // if ( tud_cdc_connected() )
{
- // connected and there are data available
+ // There are data available
if ( tud_cdc_available() )
{
uint8_t buf[64];
@@ -198,12 +200,14 @@ void cdc_task(void* params)
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
{
(void) itf;
+ (void) rts;
// connected
- if ( dtr && rts )
+ if ( dtr )
{
// print initial message when connected
tud_cdc_write_str("\r\nTinyUSB CDC MSC device with FreeRTOS example\r\n");
+ tud_cdc_write_flush();
}
}