adafruit / adafruit/Adafruit_TinyUSB_Arduino

changing CFG_TUD_HID from 2 -> 1 compile issues

Open
#496 0 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
C
Stars
654
Forks
183
PR merge metrics
No merged PRs in 30d

Description

### Operating System

Windows 10

### Arduino IDE version

Arduino 2.3.4

### Board

Feather M0 Adalogger (SAMD21)

### ArduinoCore version

1.8.5

### TinyUSB Library version

3.4.1

### Sketch as ATTACHED TXT

-

### Compiled Log as ATTACHED TXT

too many initializers in Adafruit_USBD_HID.cpp line ~33
```
Adafruit_USBD_HID *_hid_instances[CFG_TUD_HID] = { (Adafruit_USBD_HID*)(0x14254), (Adafruit_USBD_HID*)(0x9225) };
```

### What happened ?

not too difficult to fix with a #if CFG_TUD_HID== ... . But it seems these might be magic values from the testing phase, no ?
```
#if CFG_TUD_HID==2
Adafruit_USBD_HID *_hid_instances[CFG_TUD_HID] = { (Adafruit_USBD_HID*)(0x14254), (Adafruit_USBD_HID*)(0x9225) };
#elif CFG_TUD_HID==1
Adafruit_USBD_HID *_hid_instances[CFG_TUD_HID] = {0};
#endif

```

### How to reproduce ?

-

### Debug Log

_No response_

### Screenshots

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect Adafruit_USBD_HID.cpp around line 33 and reproduce the compile failure with CFG_TUD_HID set to 1 using the listed Arduino, board, and library versions. Confirm that the HID instance initialization compiles for the configured count and that the existing CFG_TUD_HID=2 case remains valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, c
Domain
embedded-iot
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.