@@ -115,8 +115,8 @@ static const uint8_t configuration_descriptor_template[] = {
115
115
static void usb_build_device_descriptor (uint16_t vid , uint16_t pid ) {
116
116
device_descriptor_allocation =
117
117
allocate_memory (align32_size (sizeof (device_descriptor_template )),
118
- /*high_address*/ false, /*movable*/ false);
119
- uint8_t * device_descriptor = (uint8_t * ) device_descriptor_allocation -> ptr ;
118
+ /*high_address*/ false, /*movable*/ false);
119
+ uint8_t * device_descriptor = (uint8_t * )device_descriptor_allocation -> ptr ;
120
120
memcpy (device_descriptor , device_descriptor_template , sizeof (device_descriptor_template ));
121
121
122
122
device_descriptor [DEVICE_VID_LO_INDEX ] = vid & 0xFF ;
@@ -142,38 +142,38 @@ static void usb_build_configuration_descriptor(void) {
142
142
143
143
// CDC should be first, for compatibility with Adafruit Windows 7 drivers.
144
144
// In the past, the order has been CDC, MSC, MIDI, HID, so preserve that order.
145
- #if CIRCUITPY_USB_CDC
145
+ #if CIRCUITPY_USB_CDC
146
146
if (usb_cdc_repl_enabled ()) {
147
147
total_descriptor_length += usb_cdc_descriptor_length ();
148
148
}
149
149
if (usb_cdc_data_enabled ()) {
150
150
total_descriptor_length += usb_cdc_descriptor_length ();
151
151
}
152
- #endif
152
+ #endif
153
153
154
- #if CIRCUITPY_USB_MSC
154
+ #if CIRCUITPY_USB_MSC
155
155
if (storage_usb_enabled ()) {
156
156
total_descriptor_length += storage_usb_descriptor_length ();
157
157
}
158
- #endif
158
+ #endif
159
159
160
- #if CIRCUITPY_USB_HID
160
+ #if CIRCUITPY_USB_HID
161
161
if (usb_hid_enabled ()) {
162
162
total_descriptor_length += usb_hid_descriptor_length ();
163
163
}
164
- #endif
164
+ #endif
165
165
166
- #if CIRCUITPY_USB_MIDI
166
+ #if CIRCUITPY_USB_MIDI
167
167
if (usb_midi_enabled ()) {
168
168
total_descriptor_length += usb_midi_descriptor_length ();
169
169
}
170
- #endif
170
+ #endif
171
171
172
172
// Now we now how big the configuration descriptor will be, so we can allocate space for it.
173
173
configuration_descriptor_allocation =
174
174
allocate_memory (align32_size (total_descriptor_length ),
175
- /*high_address*/ false, /*movable*/ false);
176
- uint8_t * configuration_descriptor = (uint8_t * ) configuration_descriptor_allocation -> ptr ;
175
+ /*high_address*/ false, /*movable*/ false);
176
+ uint8_t * configuration_descriptor = (uint8_t * )configuration_descriptor_allocation -> ptr ;
177
177
178
178
// Copy the template, which is the first part of the descriptor, and fix up its length.
179
179
@@ -189,7 +189,7 @@ static void usb_build_configuration_descriptor(void) {
189
189
190
190
uint8_t * descriptor_buf_remaining = configuration_descriptor + sizeof (configuration_descriptor_template );
191
191
192
- #if CIRCUITPY_USB_CDC
192
+ #if CIRCUITPY_USB_CDC
193
193
if (usb_cdc_repl_enabled ()) {
194
194
// Concatenate and fix up the CDC REPL descriptor.
195
195
descriptor_buf_remaining += usb_cdc_add_descriptor (
@@ -200,31 +200,31 @@ static void usb_build_configuration_descriptor(void) {
200
200
descriptor_buf_remaining += usb_cdc_add_descriptor (
201
201
descriptor_buf_remaining , & current_interface , & current_endpoint , & current_interface_string , false);
202
202
}
203
- #endif
203
+ #endif
204
204
205
- #if CIRCUITPY_USB_MSC
205
+ #if CIRCUITPY_USB_MSC
206
206
if (storage_usb_enabled ()) {
207
207
// Concatenate and fix up the MSC descriptor.
208
208
descriptor_buf_remaining += storage_usb_add_descriptor (
209
209
descriptor_buf_remaining , & current_interface , & current_endpoint , & current_interface_string );
210
210
}
211
- #endif
211
+ #endif
212
212
213
- #if CIRCUITPY_USB_HID
213
+ #if CIRCUITPY_USB_HID
214
214
if (usb_hid_enabled ()) {
215
215
descriptor_buf_remaining += usb_hid_add_descriptor (
216
216
descriptor_buf_remaining , & current_interface , & current_endpoint , & current_interface_string ,
217
217
usb_hid_report_descriptor_length ());
218
218
}
219
- #endif
219
+ #endif
220
220
221
- #if CIRCUITPY_USB_MIDI
221
+ #if CIRCUITPY_USB_MIDI
222
222
if (usb_midi_enabled ()) {
223
223
// Concatenate and fix up the MIDI descriptor.
224
224
descriptor_buf_remaining += usb_midi_add_descriptor (
225
225
descriptor_buf_remaining , & current_interface , & current_endpoint , & current_interface_string );
226
226
}
227
- #endif
227
+ #endif
228
228
229
229
// Now we know how many interfaces have been used.
230
230
configuration_descriptor [CONFIG_NUM_INTERFACES_INDEX ] = current_interface ;
@@ -251,8 +251,8 @@ static void usb_build_interface_string_table(void) {
251
251
// Space needed is 2 bytes for String Descriptor header, then 2 bytes for each character
252
252
string_descriptors_allocation =
253
253
allocate_memory (align32_size (current_interface_string * 2 + collected_interface_strings_length * 2 ),
254
- /*high_address*/ false, /*movable*/ false);
255
- uint16_t * string_descriptors = (uint16_t * ) string_descriptors_allocation -> ptr ;
254
+ /*high_address*/ false, /*movable*/ false);
255
+ uint16_t * string_descriptors = (uint16_t * )string_descriptors_allocation -> ptr ;
256
256
257
257
258
258
uint16_t * string_descriptor = string_descriptors ;
@@ -268,7 +268,7 @@ static void usb_build_interface_string_table(void) {
268
268
for (uint8_t string_index = 1 ; string_index < current_interface_string ; string_index ++ ) {
269
269
const char * str = collected_interface_strings [string_index ].char_str ;
270
270
const size_t str_len = strlen (str );
271
- uint8_t descriptor_size = 2 + (str_len * 2 );
271
+ uint8_t descriptor_size = 2 + (str_len * 2 );
272
272
string_descriptor [0 ] = 0x0300 | descriptor_size ;
273
273
274
274
// Convert to le16.
@@ -311,15 +311,15 @@ void usb_build_descriptors(void) {
311
311
// Invoked when GET DEVICE DESCRIPTOR is received.
312
312
// Application return pointer to descriptor
313
313
uint8_t const * tud_descriptor_device_cb (void ) {
314
- return (uint8_t * ) device_descriptor_allocation -> ptr ;
314
+ return (uint8_t * )device_descriptor_allocation -> ptr ;
315
315
}
316
316
317
317
// Invoked when GET CONFIGURATION DESCRIPTOR is received.
318
318
// Application return pointer to descriptor
319
319
// Descriptor contents must exist long enough for transfer to complete
320
320
uint8_t const * tud_descriptor_configuration_cb (uint8_t index ) {
321
321
(void )index ; // for multiple configurations
322
- return (uint8_t * ) configuration_descriptor_allocation -> ptr ;
322
+ return (uint8_t * )configuration_descriptor_allocation -> ptr ;
323
323
}
324
324
325
325
// Invoked when GET STRING DESCRIPTOR request is received.
0 commit comments