Skip to content

Commit 28b0eda

Browse files
Add checks for Adafruit TinyUSB to USB libs (#2319)
The included USB libraries are not compatible with Adafruit TinyUSB, so add a #error message when they're built with the define set.
1 parent 4bd7d99 commit 28b0eda

File tree

6 files changed

+30
-18
lines changed

6 files changed

+30
-18
lines changed

libraries/FatFSUSB/src/FatFSUSB.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919

2020
#pragma once
2121

22+
#ifdef USE_TINYUSB
23+
#error FatFSUSB is not compatible with Adafruit TinyUSB
24+
#endif
25+
2226
#include <Arduino.h>
2327

2428
class FatFSUSBClass {

libraries/Joystick/src/Joystick.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@
1818
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1919
*/
2020

21-
#ifndef _JOYSTICK_h
22-
#define _JOYSTICK_h
21+
#pragma once
22+
23+
#ifdef USE_TINYUSB
24+
#error Joystick is not compatible with Adafruit TinyUSB
25+
#endif
2326

2427
#include <HID_Joystick.h>
25-
#include "class/hid/hid.h"
28+
#include <class/hid/hid.h>
2629

2730
//======================================================================
2831
class Joystick_ : public HID_Joystick {
@@ -31,5 +34,3 @@ class Joystick_ : public HID_Joystick {
3134
virtual void send_now(void) override;
3235
};
3336
extern Joystick_ Joystick;
34-
35-
#endif /* _JOYSTICK_h */

libraries/Keyboard/src/Keyboard.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@
2020
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2121
*/
2222

23-
#ifndef KEYBOARD_h
24-
#define KEYBOARD_h
23+
#pragma once
24+
25+
#ifdef USE_TINYUSB
26+
#error Keyboard is not compatible with Adafruit TinyUSB
27+
#endif
2528

2629
#include <HID_Keyboard.h>
2730

@@ -34,5 +37,3 @@ class Keyboard_ : public HID_Keyboard {
3437
Keyboard_(void);
3538
};
3639
extern Keyboard_ Keyboard;
37-
38-
#endif

libraries/Mouse/src/Mouse.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@
1919
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2020
*/
2121

22-
#ifndef MOUSE_h
23-
#define MOUSE_h
22+
#pragma once
23+
24+
#ifdef USE_TINYUSB
25+
#error Mouse is not compatible with Adafruit TinyUSB
26+
#endif
2427

2528
#include <HID_Mouse.h>
2629

@@ -30,5 +33,3 @@ class Mouse_ : public HID_Mouse {
3033
virtual void move(int x, int y, signed char wheel = 0) override;
3134
};
3235
extern Mouse_ Mouse;
33-
34-
#endif

libraries/MouseAbsolute/src/MouseAbsolute.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Mouse.h
2+
MouseAbsolute.h
33
44
Copyright (c) 2015, Arduino LLC
55
Original code (pre-library): Copyright (c) 2011, Peter Barrett
@@ -19,8 +19,11 @@
1919
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2020
*/
2121

22-
#ifndef MOUSEABSOLUTE_h
23-
#define MOUSEABSOLUTE_h
22+
#pragma once
23+
24+
#ifdef USE_TINYUSB
25+
#error MouseAbsolute is not compatible with Adafruit TinyUSB
26+
#endif
2427

2528
#include <HID_Mouse.h>
2629

@@ -30,5 +33,3 @@ class MouseAbsolute_ : public HID_Mouse {
3033
virtual void move(int x, int y, signed char wheel = 0) override;
3134
};
3235
extern MouseAbsolute_ MouseAbsolute;
33-
34-
#endif

libraries/SingleFileDrive/src/SingleFileDrive.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919

2020
#pragma once
2121

22+
#ifdef USE_TINYUSB
23+
#error SingleFileDrive is not compatible with Adafruit TinyUSB
24+
#endif
25+
2226
#include <Arduino.h>
2327

2428
class SingleFileDrive {

0 commit comments

Comments
 (0)