4040 #include "freertos/timers.h"
4141
4242 #define USBH_STACK_SIZE 4096
43- #define CDC_STACK_SZIE 2048
4443#else
4544 #include "FreeRTOS.h"
4645 #include "semphr.h"
5049
5150 // Increase stack size when debug log is enabled
5251 #define USBH_STACK_SIZE (3*configMINIMAL_STACK_SIZE/2) * (CFG_TUSB_DEBUG ? 2 : 1)
53- #define CDC_STACK_SZIE (3*configMINIMAL_STACK_SIZE/2)
5452#endif
5553
5654
@@ -74,38 +72,30 @@ StaticTimer_t blinky_tmdef;
7472
7573StackType_t usb_host_stack [USBH_STACK_SIZE ];
7674StaticTask_t usb_host_taskdef ;
77-
78- StackType_t cdc_stack [CDC_STACK_SZIE ];
79- StaticTask_t cdc_taskdef ;
8075#endif
8176
8277TimerHandle_t blinky_tm ;
8378
8479static void led_blinky_cb (TimerHandle_t xTimer );
80+ static void usb_host_task (void * param );
81+
8582extern void cdc_app_init (void );
8683extern void hid_app_init (void );
8784extern void msc_app_init (void );
8885
89- static void usb_host_task (void * param );
90- extern void cdc_app_task (void * param );
91-
92-
93-
9486/*------------- MAIN -------------*/
9587int main (void ) {
9688 board_init ();
9789
9890 printf ("TinyUSB Host CDC MSC HID with FreeRTOS Example\r\n" );
9991
100- // Create soft timer for blinky, task for tinyusb stack and CDC
92+ // Create soft timer for blinky, task for tinyusb stack
10193#if configSUPPORT_STATIC_ALLOCATION
10294 blinky_tm = xTimerCreateStatic (NULL , pdMS_TO_TICKS (BLINK_MOUNTED ), true, NULL , led_blinky_cb , & blinky_tmdef );
10395 xTaskCreateStatic (usb_host_task , "usbh" , USBH_STACK_SIZE , NULL , configMAX_PRIORITIES - 1 , usb_host_stack , & usb_host_taskdef );
104- xTaskCreateStatic (cdc_app_task , "cdc" , CDC_STACK_SZIE , NULL , configMAX_PRIORITIES - 2 , cdc_stack , & cdc_taskdef );
10596#else
10697 blinky_tm = xTimerCreate (NULL , pdMS_TO_TICKS (BLINK_NOT_MOUNTED ), true, NULL , led_blinky_cb );
10798 xTaskCreate (usb_host_task , "usbd" , USBH_STACK_SIZE , NULL , configMAX_PRIORITIES - 1 , NULL );
108- xTaskCreate (cdc_app_task , "cdc" , CDC_STACK_SZIE , NULL , configMAX_PRIORITIES - 2 , NULL );
10999#endif
110100
111101 xTimerStart (blinky_tm , 0 );
0 commit comments