9
9
10
10
#include <stdlib.h>
11
11
#include "esp_log.h"
12
+ #include "driver/gpio.h"
12
13
#include "freertos/FreeRTOS.h"
13
14
#include "freertos/task.h"
14
- #include "driver/gpio.h"
15
- #include "sdkconfig.h"
16
15
#include "tinyusb.h"
16
+ #include "sdkconfig.h"
17
17
18
18
static const char * TAG = "example" ;
19
19
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
+ {
32
22
ESP_LOGI (TAG , "USB initialization" );
33
23
34
24
#if CONFIG_EXAMPLE_MANUAL_DESC
@@ -39,7 +29,7 @@ void app_main(void) {
39
29
.bDescriptorType = TUSB_DESC_DEVICE ,
40
30
.bcdUSB = 0x0200 , // USB version. 0x0200 means version 2.0
41
31
.bDeviceClass = TUSB_CLASS_UNSPECIFIED ,
42
- .bMaxPacketSize0 = CFG_TUD_ENDOINT0_SIZE ,
32
+ .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE ,
43
33
44
34
.idVendor = 0x303A ,
45
35
.idProduct = 0x3000 ,
@@ -49,7 +39,8 @@ void app_main(void) {
49
39
.iProduct = 0x02 , // see string_descriptor[2] bellow
50
40
.iSerialNumber = 0x03 , // see string_descriptor[3] bellow
51
41
52
- .bNumConfigurations = 0x01 };
42
+ .bNumConfigurations = 0x01
43
+ };
53
44
54
45
tusb_desc_strarray_device_t my_string_descriptor = {
55
46
// array of pointer to string descriptors
@@ -77,8 +68,4 @@ void app_main(void) {
77
68
78
69
ESP_ERROR_CHECK (tinyusb_driver_install (& tusb_cfg ));
79
70
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 ;
84
71
}
0 commit comments