diff options
| author | hathach <[email protected]> | 2018-12-13 13:49:09 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-12-13 13:49:09 +0700 |
| commit | bc46dc6edf3ff4bb72fb36e74b8a7d3da447d2d4 (patch) | |
| tree | fc8042f6113d6dc224543d00578759eb6a0c60f4 /examples/device/cdc_msc_hid/src | |
| parent | b562fa741b5a8bb47d4e32c0a0f2600b72993b9a (diff) | |
osal clean up
remove OSAL_TASK_DEF, osal_task_create. Applicaton should create a task
and call tinyusb_task(). This make API consistent with NO OS.
Diffstat (limited to 'examples/device/cdc_msc_hid/src')
| -rw-r--r-- | examples/device/cdc_msc_hid/src/main.c | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/examples/device/cdc_msc_hid/src/main.c b/examples/device/cdc_msc_hid/src/main.c index bc260fdfa..178609e1e 100644 --- a/examples/device/cdc_msc_hid/src/main.c +++ b/examples/device/cdc_msc_hid/src/main.c @@ -46,7 +46,6 @@ //--------------------------------------------------------------------+ // MACRO CONSTANT TYPEDEF PROTYPES //--------------------------------------------------------------------+ -void print_greeting(void); void led_blinking_task(void); extern void virtual_com_task(void); @@ -56,7 +55,6 @@ extern void usb_hid_task(void); int main(void) { board_init(); - print_greeting(); tusb_init(); @@ -84,9 +82,9 @@ int main(void) #if CFG_TUD_CDC void virtual_com_task(void) { - // connected and there are data available if ( tud_cdc_connected() ) { + // connected and there are data available if ( tud_cdc_available() ) { uint8_t buf[64]; @@ -98,11 +96,7 @@ void virtual_com_task(void) { tud_cdc_write_char(buf[i]); - if ( buf[i] == '\r' ) - { - tud_cdc_write_char('\n'); - tud_cdc_write_str("tinyusb cdc: "); - } + if ( buf[i] == '\r' ) tud_cdc_write_char('\n'); } tud_cdc_write_flush(); @@ -117,8 +111,8 @@ void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) // connected if ( dtr && rts ) { - // print greeting - tud_cdc_write_str("tinyusb cdc: "); + // print initial message when connected + tud_cdc_write_str("\r\nTinyUSB CDC MSC HID device example\r\n"); } } #endif @@ -213,28 +207,3 @@ void led_blinking_task(void) board_led_control(led_state); led_state = 1 - led_state; // toggle } - -//--------------------------------------------------------------------+ -// HELPER FUNCTION -//--------------------------------------------------------------------+ -void print_greeting(void) -{ - char const * const rtos_name[] = - { - [OPT_OS_NONE] = "None", - [OPT_OS_FREERTOS] = "FreeRTOS", - }; - - printf("\n--------------------------------------------------------------------\n"); - printf("- Device Demo (a tinyusb example)\n"); - printf("- if you find any bugs or get any questions, feel free to file an\n"); - printf("- issue at https://github.com/hathach/tinyusb\n"); - printf("--------------------------------------------------------------------\n\n"); - - printf("This DEVICE demo is configured to support:"); - printf(" - RTOS = %s\n", rtos_name[CFG_TUSB_OS]); - if (CFG_TUD_CDC ) puts(" - Communication Device Class"); - if (CFG_TUD_MSC ) puts(" - Mass Storage"); - if (CFG_TUD_HID_KEYBOARD ) puts(" - HID Keyboard"); - if (CFG_TUD_HID_MOUSE ) puts(" - HID Mouse"); -} |
