Reset CDC examples to original state
This commit is contained in:
@@ -82,6 +82,8 @@ 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) )
|
||||||
{
|
{
|
||||||
@@ -94,4 +96,5 @@ static void cdc_task(void)
|
|||||||
echo_serial_port(1, buf, count);
|
echo_serial_port(1, buf, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -105,7 +105,9 @@ void tud_resume_cb(void)
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void cdc_task(void)
|
void cdc_task(void)
|
||||||
{
|
{
|
||||||
// is data available to read from rx fifo
|
if ( tud_cdc_connected() )
|
||||||
|
{
|
||||||
|
// connected and there are data available
|
||||||
if ( tud_cdc_available() )
|
if ( tud_cdc_available() )
|
||||||
{
|
{
|
||||||
uint8_t buf[64];
|
uint8_t buf[64];
|
||||||
@@ -122,14 +124,15 @@ void cdc_task(void)
|
|||||||
|
|
||||||
tud_cdc_write_flush();
|
tud_cdc_write_flush();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invoked when cdc line state changed e.g connected/disconnected
|
// Invoked when cdc when 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;
|
||||||
|
|
||||||
// usually terminal software sets DTR and RTS when connected
|
// connected
|
||||||
if ( dtr && rts )
|
if ( dtr && rts )
|
||||||
{
|
{
|
||||||
// print initial message when connected
|
// print initial message when connected
|
||||||
|
@@ -168,7 +168,9 @@ void cdc_task(void* params)
|
|||||||
// RTOS forever loop
|
// RTOS forever loop
|
||||||
while ( 1 )
|
while ( 1 )
|
||||||
{
|
{
|
||||||
// is data available to read from rx fifo
|
if ( tud_cdc_connected() )
|
||||||
|
{
|
||||||
|
// connected and there are data available
|
||||||
if ( tud_cdc_available() )
|
if ( tud_cdc_available() )
|
||||||
{
|
{
|
||||||
uint8_t buf[64];
|
uint8_t buf[64];
|
||||||
@@ -185,18 +187,19 @@ 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 line state changed e.g connected/disconnected
|
// Invoked when cdc when 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;
|
||||||
|
|
||||||
// usually terminal software sets DTR and RTS when connected
|
// connected
|
||||||
if ( dtr && rts )
|
if ( dtr && rts )
|
||||||
{
|
{
|
||||||
// print initial message when connected
|
// print initial message when connected
|
||||||
|
Reference in New Issue
Block a user