mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-21 21:41:09 +00:00
Remove tud_cdc_connected check from examples
This commit is contained in:
parent
9cc22b635c
commit
e09ebea7b9
@ -82,8 +82,6 @@ static void cdc_task(void)
|
|||||||
uint8_t itf;
|
uint8_t itf;
|
||||||
|
|
||||||
for (itf = 0; itf < CFG_TUD_CDC; itf++)
|
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) )
|
||||||
{
|
{
|
||||||
@ -96,5 +94,4 @@ static void cdc_task(void)
|
|||||||
echo_serial_port(1, buf, count);
|
echo_serial_port(1, buf, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -105,9 +105,7 @@ void tud_resume_cb(void)
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void cdc_task(void)
|
void cdc_task(void)
|
||||||
{
|
{
|
||||||
if ( tud_cdc_connected() )
|
// is data available to read from rx fifo
|
||||||
{
|
|
||||||
// connected and there are data available
|
|
||||||
if ( tud_cdc_available() )
|
if ( tud_cdc_available() )
|
||||||
{
|
{
|
||||||
uint8_t buf[64];
|
uint8_t buf[64];
|
||||||
@ -124,15 +122,14 @@ void cdc_task(void)
|
|||||||
|
|
||||||
tud_cdc_write_flush();
|
tud_cdc_write_flush();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invoked when cdc when line state changed e.g connected/disconnected
|
// Invoked when cdc line state changed e.g connected/disconnected
|
||||||
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
|
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
|
||||||
{
|
{
|
||||||
(void) itf;
|
(void) itf;
|
||||||
|
|
||||||
// connected
|
// usually terminal software sets DTR and RTS when connected
|
||||||
if ( dtr && rts )
|
if ( dtr && rts )
|
||||||
{
|
{
|
||||||
// print initial message when connected
|
// print initial message when connected
|
||||||
|
@ -168,9 +168,7 @@ void cdc_task(void* params)
|
|||||||
// RTOS forever loop
|
// RTOS forever loop
|
||||||
while ( 1 )
|
while ( 1 )
|
||||||
{
|
{
|
||||||
if ( tud_cdc_connected() )
|
// is data available to read from rx fifo
|
||||||
{
|
|
||||||
// connected and there are data available
|
|
||||||
if ( tud_cdc_available() )
|
if ( tud_cdc_available() )
|
||||||
{
|
{
|
||||||
uint8_t buf[64];
|
uint8_t buf[64];
|
||||||
@ -187,19 +185,18 @@ void cdc_task(void* params)
|
|||||||
|
|
||||||
tud_cdc_write_flush();
|
tud_cdc_write_flush();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// For ESP32-S2 this delay is essential to allow idle how to run and reset wdt
|
// For ESP32-S2 this delay is essential to allow idle how to run and reset wdt
|
||||||
vTaskDelay(pdMS_TO_TICKS(10));
|
vTaskDelay(pdMS_TO_TICKS(10));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invoked when cdc when line state changed e.g connected/disconnected
|
// Invoked when cdc line state changed e.g connected/disconnected
|
||||||
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
|
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
|
||||||
{
|
{
|
||||||
(void) itf;
|
(void) itf;
|
||||||
|
|
||||||
// connected
|
// usually terminal software sets DTR and RTS when connected
|
||||||
if ( dtr && rts )
|
if ( dtr && rts )
|
||||||
{
|
{
|
||||||
// print initial message when connected
|
// print initial message when connected
|
||||||
|
Loading…
x
Reference in New Issue
Block a user