99
1010#include <stdlib.h>
1111#include "esp_log.h"
12+ #include "driver/gpio.h"
1213#include "freertos/FreeRTOS.h"
1314#include "freertos/task.h"
14- #include "driver/gpio.h"
15- #include "sdkconfig.h"
1615#include "tinyusb.h"
16+ #include "sdkconfig.h"
1717
1818static const char * TAG = "example" ;
1919
20- // USB Device Driver task
21- // This top level thread processes all usb events and invokes callbacks
22- static void usb_device_task (void * param ) {
23- (void )param ;
24- ESP_LOGI (TAG , "USB task started" );
25- while (1 ) {
26- tud_task (); // RTOS forever loop
27- }
28- }
29-
30- void app_main (void ) {
31-
20+ void app_main (void )
21+ {
3222 ESP_LOGI (TAG , "USB initialization" );
3323
3424#if CONFIG_EXAMPLE_MANUAL_DESC
@@ -39,7 +29,7 @@ void app_main(void) {
3929 .bDescriptorType = TUSB_DESC_DEVICE ,
4030 .bcdUSB = 0x0200 , // USB version. 0x0200 means version 2.0
4131 .bDeviceClass = TUSB_CLASS_UNSPECIFIED ,
42- .bMaxPacketSize0 = CFG_TUD_ENDOINT0_SIZE ,
32+ .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE ,
4333
4434 .idVendor = 0x303A ,
4535 .idProduct = 0x3000 ,
@@ -49,7 +39,8 @@ void app_main(void) {
4939 .iProduct = 0x02 , // see string_descriptor[2] bellow
5040 .iSerialNumber = 0x03 , // see string_descriptor[3] bellow
5141
52- .bNumConfigurations = 0x01 };
42+ .bNumConfigurations = 0x01
43+ };
5344
5445 tusb_desc_strarray_device_t my_string_descriptor = {
5546 // array of pointer to string descriptors
@@ -77,8 +68,4 @@ void app_main(void) {
7768
7869 ESP_ERROR_CHECK (tinyusb_driver_install (& tusb_cfg ));
7970 ESP_LOGI (TAG , "USB initialization DONE" );
80-
81- // Create a task for tinyusb device stack:
82- xTaskCreate (usb_device_task , "usbd" , 4096 , NULL , 5 , NULL );
83- return ;
8471}
0 commit comments