ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
descriptors_control.h File Reference
#include "tusb.h"
#include "tinyusb_types.h"
Include dependency graph for descriptors_control.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void tusb_set_descriptor (const tusb_desc_device_t *dev_desc, const char **str_desc, const uint8_t *cfg_desc)
tusb_desc_device_t * tusb_get_active_desc (void)
char ** tusb_get_active_str_desc (void)
void tusb_clear_descriptor (void)

Function Documentation

◆ tusb_clear_descriptor()

void tusb_clear_descriptor ( void )

Definition at line 146 of file descriptors_control.c.

147{
148 memset(&s_device_descriptor, 0, sizeof(s_device_descriptor));
149 memset(&s_str_descriptor, 0, sizeof(s_str_descriptor));
150}
static tusb_desc_device_t s_device_descriptor
static char * s_str_descriptor[USB_STRING_DESCRIPTOR_ARRAY_SIZE]

References s_device_descriptor, and s_str_descriptor.

◆ tusb_get_active_desc()

tusb_desc_device_t * tusb_get_active_desc ( void )

Definition at line 136 of file descriptors_control.c.

137{
138 return &s_device_descriptor;
139}

References s_device_descriptor.

◆ tusb_get_active_str_desc()

char ** tusb_get_active_str_desc ( void )

Definition at line 141 of file descriptors_control.c.

142{
143 return s_str_descriptor;
144}

References s_str_descriptor.

◆ tusb_set_descriptor()

void tusb_set_descriptor ( const tusb_desc_device_t * dev_desc,
const char ** str_desc,
const uint8_t * cfg_desc )

Definition at line 94 of file descriptors_control.c.

95{
96 ESP_LOGI(TAG, "\n"
97 "┌─────────────────────────────────┐\n"
98 "│ USB Device Descriptor Summary │\n"
99 "├───────────────────┬─────────────┤\n"
100 "│bDeviceClass │ %-4u │\n"
101 "├───────────────────┼─────────────┤\n"
102 "│bDeviceSubClass │ %-4u │\n"
103 "├───────────────────┼─────────────┤\n"
104 "│bDeviceProtocol │ %-4u │\n"
105 "├───────────────────┼─────────────┤\n"
106 "│bMaxPacketSize0 │ %-4u │\n"
107 "├───────────────────┼─────────────┤\n"
108 "│idVendor │ %-#10x │\n"
109 "├───────────────────┼─────────────┤\n"
110 "│idProduct │ %-#10x │\n"
111 "├───────────────────┼─────────────┤\n"
112 "│bcdDevice │ %-#10x │\n"
113 "├───────────────────┼─────────────┤\n"
114 "│iManufacturer │ %-#10x │\n"
115 "├───────────────────┼─────────────┤\n"
116 "│iProduct │ %-#10x │\n"
117 "├───────────────────┼─────────────┤\n"
118 "│iSerialNumber │ %-#10x │\n"
119 "├───────────────────┼─────────────┤\n"
120 "│bNumConfigurations │ %-#10x │\n"
121 "└───────────────────┴─────────────┘",
122 dev_desc->bDeviceClass, dev_desc->bDeviceSubClass,
123 dev_desc->bDeviceProtocol, dev_desc->bMaxPacketSize0,
124 dev_desc->idVendor, dev_desc->idProduct, dev_desc->bcdDevice,
125 dev_desc->iManufacturer, dev_desc->iProduct, dev_desc->iSerialNumber,
126 dev_desc->bNumConfigurations);
127 s_device_descriptor = *dev_desc;
129
130 if (str_desc != NULL) {
131 memcpy(s_str_descriptor, str_desc,
133 }
134}
static const uint8_t * s_configuration_descriptor
static const char * TAG
Definition main/main.c:31
#define USB_STRING_DESCRIPTOR_ARRAY_SIZE

References s_configuration_descriptor, s_device_descriptor, s_str_descriptor, TAG, and USB_STRING_DESCRIPTOR_ARRAY_SIZE.

Referenced by tinyusb_driver_install().

Here is the caller graph for this function: