mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
Reset CDC examples to original state
This commit is contained in:
parent
54e29e9ff4
commit
e7069da7eb
@ -82,6 +82,8 @@ static void cdc_task(void)
|
||||
uint8_t itf;
|
||||
|
||||
for (itf = 0; itf < CFG_TUD_CDC; itf++)
|
||||
{
|
||||
if ( tud_cdc_n_connected(itf) )
|
||||
{
|
||||
if ( tud_cdc_n_available(itf) )
|
||||
{
|
||||
@ -94,4 +96,5 @@ static void cdc_task(void)
|
||||
echo_serial_port(1, buf, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,9 @@ void tud_resume_cb(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() )
|
||||
{
|
||||
uint8_t buf[64];
|
||||
@ -122,14 +124,15 @@ void cdc_task(void)
|
||||
|
||||
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) itf;
|
||||
|
||||
// usually terminal software sets DTR and RTS when connected
|
||||
// connected
|
||||
if ( dtr && rts )
|
||||
{
|
||||
// print initial message when connected
|
||||
|
@ -168,7 +168,9 @@ void cdc_task(void* params)
|
||||
// RTOS forever loop
|
||||
while ( 1 )
|
||||
{
|
||||
// is data available to read from rx fifo
|
||||
if ( tud_cdc_connected() )
|
||||
{
|
||||
// connected and there are data available
|
||||
if ( tud_cdc_available() )
|
||||
{
|
||||
uint8_t buf[64];
|
||||
@ -185,18 +187,19 @@ void cdc_task(void* params)
|
||||
|
||||
tud_cdc_write_flush();
|
||||
}
|
||||
}
|
||||
|
||||
// For ESP32-S2 this delay is essential to allow idle how to run and reset wdt
|
||||
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) itf;
|
||||
|
||||
// usually terminal software sets DTR and RTS when connected
|
||||
// connected
|
||||
if ( dtr && rts )
|
||||
{
|
||||
// print initial message when connected
|
||||
|
Loading…
x
Reference in New Issue
Block a user