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.
This commit is contained in:
		| @@ -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"); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 hathach
					hathach