8000 Use correct tusb_config.h for built-in usb (pico-sdk) (#219) · Robotonics/arduino-pico@7eca6c6 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7eca6c6

Browse files
authored
Use correct tusb_config.h for built-in usb (pico-sdk) (earlephilhower#219)
Fix issue with usbd_desc_cfg value may not be initialized as zero.
1 parent f299120 commit 7eca6c6

File tree

4 files changed

+8
-32
lines changed

4 files changed

+8
-32
lines changed

cores/rp2040/RP2040USB.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ uint8_t const * tud_hid_descriptor_report_cb(uint8_t instance) {
161161

162162
const uint8_t *tud_descriptor_configuration_cb(uint8_t index) {
163163
(void)index;
164-
static uint8_t *usbd_desc_cfg;
164+
static uint8_t *usbd_desc_cfg = NULL;
165165

166166
if (!usbd_desc_cfg) {
167167
bool hasHID = __USBInstallKeyboard || __USBInstallMouse;

lib/libpico.a

2.39 KB
Binary file not shown.

lib/platform_inc.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@
5353
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_runtime/include
5454
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_stdio/include
5555
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_stdio_uart/include
56-
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_stdio_usb/include
5756
-iwithprefixbefore/pico-sdk/src/rp2_common/pico_unique_id/include
57+
-iwithprefixbefore/tools/libpico

tools/libpico/tusb_config.h

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -34,41 +34,17 @@
3434
// COMMON CONFIGURATION
3535
//--------------------------------------------------------------------
3636

37-
// defined by board.mk
3837
#ifndef CFG_TUSB_MCU
39-
#error CFG_TUSB_MCU must be defined
38+
#define CFG_TUSB_MCU OPT_MCU_RP2040
4039
#endif
4140

42-
// RHPort number used for device can be defined by board.mk, default to port 0
43-
#ifndef BOARD_DEVICE_RHPORT_NUM
44-
#define BOARD_DEVICE_RHPORT_NUM 0
45-
#endif
46-
47-
// RHPort max operational speed can defined by board.mk
48-
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed
49-
#ifndef BOARD_DEVICE_RHPORT_SPEED
50-
#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \
51-
CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56)
52-
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
53-
#else
54-
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
55-
#endif
56-
#endif
57-
58-
// Device mode with rhport and speed defined by board.mk
59-
#if BOARD_DEVICE_RHPORT_NUM == 0
60-
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | BOARD_DEVICE_RHPORT_SPEED)
61-
#elif BOARD_DEVICE_RHPORT_NUM == 1
62-
#define CFG_TUSB_RHPORT1_MODE (OPT_MODE_DEVICE | BOARD_DEVICE_RHPORT_SPEED)
63-
#else
64-
#error "Incorrect RHPort configuration"
65-
#endif
66-
67-
// This example doesn't use an RTOS
68-
//#define CFG_TUSB_OS OPT_OS_NONE
41+
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
42+
#define CFG_TUSB_OS OPT_OS_PICO
6943

7044
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
71-
// #define CFG_TUSB_DEBUG 0
45+
#ifndef CFG_TUSB_DEBUG
46+
#define CFG_TUSB_DEBUG 0
47+
#endif
7248

7349
/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
7450
* Tinyusb use follows macros to declare transferring memory so that they can be put

0 commit comments

Comments
 (0)
0