diff options
| author | hathach <[email protected]> | 2018-12-07 17:37:54 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-12-07 17:37:54 +0700 |
| commit | e6e367913664140729fa88605da7f1dc52439e16 (patch) | |
| tree | d16548bd5b6f1d18a063e88522ecbd9d6dc2e0d9 /examples | |
| parent | 13d08cd63681c20d30e07e8fdcb4ac8d863453a5 (diff) | |
simple cdc host demo work
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/host/cdc_msc_hid/src/main.c | 6 | ||||
| -rw-r--r-- | examples/host/cdc_msc_hid/src/tusb_config.h | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/examples/host/cdc_msc_hid/src/main.c b/examples/host/cdc_msc_hid/src/main.c index 88d7cd4de..7f8b9d6e2 100644 --- a/examples/host/cdc_msc_hid/src/main.c +++ b/examples/host/cdc_msc_hid/src/main.c @@ -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) diff --git a/examples/host/cdc_msc_hid/src/tusb_config.h b/examples/host/cdc_msc_hid/src/tusb_config.h index b7a766796..ea411d3f4 100644 --- a/examples/host/cdc_msc_hid/src/tusb_config.h +++ b/examples/host/cdc_msc_hid/src/tusb_config.h @@ -82,10 +82,10 @@ #define CFG_TUH_HUB 1 // not tested #define CFG_TUH_CDC 1 -#define CFG_TUH_HID_KEYBOARD 1 -#define CFG_TUH_HID_MOUSE 1 +#define CFG_TUH_HID_KEYBOARD 0 +#define CFG_TUH_HID_MOUSE 0 #define CFG_TUSB_HOST_HID_GENERIC 0 // (not yet supported) -#define CFG_TUH_MSC 1 +#define CFG_TUH_MSC 0 #define CFG_TUSB_HOST_DEVICE_MAX (CFG_TUH_HUB ? 5 : 1) // normal hub has 4 ports |
