Skip to content

Commit 50d3563

Browse files
Remove TUSB HID defines for BTStack compat
BTStack redefines HID values that TinyUSB does, causing issues when we include TUSB.h. Avoid including HID in SerialUSB, it's a CDC anyway.
1 parent 5746de8 commit 50d3563

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

cores/rp2040/SerialUSB.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,17 @@
2323
#include <Arduino.h>
2424
#include "api/HardwareSerial.h"
2525
#include <stdarg.h>
26-
#include <tusb.h>
2726

27+
// We need the TUSB defines, but BTStack redefines them. So for this header we
28+
// turn on off HID before doing the include and then restore it after the include
29+
// is processed.
30+
#define SAVE_CFG_TUD_HID CFG_TUD_HID
31+
#undef CFG_TUD_HID
32+
#define CFG_TUD_HID 0
33+
#include <tusb.h>
34+
#undef CFG_TUD_HID
35+
#define CFG_TUD_HID SAVE_CFG_TUD_HID
36+
#undef SAVE_CFG_TUD_HID
2837
class SerialUSB : public arduino::HardwareSerial {
2938
public:
3039
SerialUSB();

0 commit comments

Comments
 (0)