finalizing cdc host, has a working read/write

TODO: first character seems not to get echoed. set control line state
seems to failed with LOG < 2
This commit is contained in:
hathach
2022-12-21 00:26:46 +07:00
parent 7004914d8c
commit 854e5222ae
3 changed files with 423 additions and 145 deletions

View File

@@ -61,24 +61,6 @@ int main(void)
return 0;
}
//--------------------------------------------------------------------+
// USB CDC
//--------------------------------------------------------------------+
CFG_TUSB_MEM_SECTION static char serial_in_buffer[64] = { 0 };
// invoked ISR context
void tuh_cdc_xfer_isr(uint8_t dev_addr, xfer_result_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes)
{
(void) event;
(void) pipe_id;
(void) xferred_bytes;
printf(serial_in_buffer);
tu_memclr(serial_in_buffer, sizeof(serial_in_buffer));
tuh_cdc_receive(dev_addr, serial_in_buffer, sizeof(serial_in_buffer), true); // waiting for next data
}
//--------------------------------------------------------------------+
// TinyUSB Callbacks
//--------------------------------------------------------------------+