Skip to content

Commit 2d22cf2

Browse files
Clean up includes
1 parent 241884b commit 2d22cf2

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

cores/rp2040/RP2040USB.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,12 @@
2727

2828
#include <tusb.h>
2929
#include <class/hid/hid_device.h>
30-
#include <class/audio/audio.h>
3130
#include <pico/time.h>
3231
#include <hardware/irq.h>
3332
#include <pico/mutex.h>
3433
#include <pico/unique_id.h>
3534
#include <pico/usb_reset_interface.h>
3635
#include <hardware/watchdog.h>
37-
#include <pico/bootrom.h>
38-
#include "sdkoverride/tusb_gamepad16.h"
39-
#include <device/usbd_pvt.h>
4036

4137
// Big, global USB mutex, shared with all USB devices to make sure we don't
4238
// have multiple cores updating the TUSB state in parallel
@@ -76,17 +72,21 @@ typedef struct Entry {
7672
static Entry *_hids = nullptr;
7773
static Entry *_interfaces = nullptr;
7874

79-
// USB strings kept in a list of pointers
75+
// USB strings kept in a list of pointers. Can't use std::vector again because of
76+
// CRT init non-ordering.
8077
static const char **usbd_desc_str;
8178
static uint8_t usbd_desc_str_cnt = 0;
8279
static uint8_t usbd_desc_str_alloc = 0;
80+
81+
// HID report
8382
static int __hid_report_len = 0;
8483
static uint8_t *__hid_report = nullptr;
84+
85+
// Global USB descriptor
8586
static uint8_t *usbd_desc_cfg = nullptr;
8687
#ifdef ENABLE_PICOTOOL_USB
8788
static uint8_t _picotool_itf_num;
8889
#endif
89-
9090
int usb_hid_poll_interval __attribute__((weak)) = 10;
9191

9292

@@ -133,7 +133,7 @@ static uint8_t AddEntry(Entry **head, int interfaces, const uint8_t *descriptor,
133133
}
134134

135135
// Find the index (HID report ID or USB interface) of a given localid
136-
unsigned int usbFindID(Entry *head, unsigned int localid) {
136+
static unsigned int usbFindID(Entry *head, unsigned int localid) {
137137
unsigned int x = 0;
138138
while (head && head->localid != localid) {
139139
head = head->next;
@@ -276,6 +276,10 @@ const uint8_t *tud_descriptor_configuration_cb(uint8_t index) {
276276
return usbd_desc_cfg;
277277
}
278278

279+
// Build the binary image of the complete USB descriptor
280+
// Note that we can add stack-allocated descriptors here because we know
281+
// we're going to use them before the function exits and they'll not be
282+
// needed ever again
279283
void __SetupUSBDescriptor() {
280284
uint8_t interface_count = 0;
281285
int usbd_desc_len;

0 commit comments

Comments
 (0)