|
|
@@ -82,11 +82,14 @@ int main(void)
|
|
|
// USB CDC
|
|
|
//--------------------------------------------------------------------+
|
|
|
#if CFG_TUH_CDC
|
|
|
+CFG_TUSB_MEM_SECTION static char serial_in_buffer[64] = { 0 };
|
|
|
|
|
|
void tuh_cdc_mounted_cb(uint8_t dev_addr)
|
|
|
{
|
|
|
// application set-up
|
|
|
printf("\na CDC device (address %d) is mounted\n", dev_addr);
|
|
|
+
|
|
|
+ tuh_cdc_receive(dev_addr, serial_in_buffer, sizeof(serial_in_buffer), true); // schedule first transfer
|
|
|
}
|
|
|
|
|
|
void tuh_cdc_unmounted_cb(uint8_t dev_addr)
|
|
|
@@ -98,7 +101,10 @@ void tuh_cdc_unmounted_cb(uint8_t dev_addr)
|
|
|
// 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)
|
|
|
{
|
|
|
+ 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
|
|
|
}
|
|
|
|
|
|
void virtual_com_task(void)
|