Skip to content

Commit 7aa1c08

Browse files
Use generic HID classes to minimize code duplic'n (#1254)
Move the Joystick, Keyboard, and Mouse into a base class which handles the operation/input, and a subclass which will implement the reporting as a HID device via USB, Bluetooth Classic, or Bluetooth Low Energy (BLE). Reduce copies of library code and makes maintainability much better.
1 parent 0be1d9c commit 7aa1c08

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1668
-3108
lines changed

.gitmodules

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
path = libraries/ESP8266SdFat
1515
url = https://github.com/earlephilhower/ESP8266SdFat.git
1616
[submodule "libraries/Keyboard"]
17-
path = libraries/Keyboard
18-
url = https://github.com/earlephilhower/Keyboard
17+
path = libraries/HID_Keyboard
18+
url = https://github.com/earlephilhower/Keyboard.git
1919
[submodule "libraries/Mouse"]
20-
path = libraries/Mouse
21-
url = https://github.com/earlephilhower/Mouse
20+
path = libraries/HID_Mouse
21+
url = https://github.com/earlephilhower/Mouse.git
2222
[submodule "libraries/Joystick"]
23-
path = libraries/Joystick
24-
url = https://github.com/benjaminaigner/Joystick
23+
path = libraries/HID_Joystick
24+
url = https://github.com/earlephilhower/Joystick.git
2525
[submodule "libraries/Adafruit_TinyUSB_Arduino"]
2626
path = libraries/Adafruit_TinyUSB_Arduino
2727
url = https://github.com/adafruit/Adafruit_TinyUSB_Arduino.git

libraries/PicoBluetoothBLEHID/keywords.txt renamed to libraries/HID_Bluetooth/keywords.txt

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# Datatypes (KEYWORD1)
77
#######################################
88

9+
PicoBluetoothHID KEYWORD1
910
PicoBluetoothBLEHID KEYWORD1
1011

1112
#######################################
@@ -20,8 +21,10 @@ connected KEYWORD2
2021
send KEYWORD2
2122
lockBluetooth KEYWORD2
2223
unlockBluetooth KEYWORD2
24+
getCID KEYWORD2
2325
setBattery KEYWORD2
2426

2527
#######################################
2628
# Constants (LITERAL1)
2729
#######################################
30+
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name=PicoBluetoothBLEHID
1+
name=HID_Bluetooth
22
version=1.0.0
33
author=Earle F. Philhower, III <[email protected]>
44
maintainer=Earle F. Philhower, III <[email protected]>
5-
sentence=Implements a HID device base class for PicoW Bluetooth BLE
6-
paragraph=Implements a HID device base class for PicoW Bluetooth BLE
5+
sentence=Implements a HID device base class for PicoW Bluetooth
6+
paragraph=Implements a HID device base class for PicoW Bluetooth
77
category=Device Control
88
url=https://github.com/earlephilhower/arduino-pico
99
architectures=rp2040
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#ifdef ENABLE_CLASSIC
2+
#include "PicoBluetoothHID.h"
3+
#endif
4+
5+
#ifdef ENABLE_BLE
6+
#include "PicoBluetoothBLEHID.h"
7+
#endif

libraries/HID_Joystick

Submodule HID_Joystick added at 4eb3e28

libraries/HID_Keyboard

Submodule HID_Keyboard added at 74c3b2f

libraries/HID_Mouse

Submodule HID_Mouse added at 2aa06d1

libraries/Joystick

-1
This file was deleted.

libraries/Joystick/README.adoc

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
:repository-owner: arduino-libraries
2+
:repository-name: Joystick
3+
4+
= {repository-name} Library for Arduino (RP2040 based boards) =
5+
6+
This library allows an RaspberryPi RP2040 board to act as a Joystick when
7+
Earle F. Philhower`s [arduino-pico](https://github.com/earlephilhower/arduino-pico)
8+
Core is used.
9+
10+
== Acknowledgements / Credits ==
11+
12+
* [arduino-pico](https://github.com/earlephilhower/arduino-pico) Earle F. Philhower providing the Arduino Core, on which this library is based on, available under LGPL.
13+
* [tinyUSB] (https://github.com/hathach/tinyusb) Ha Thach for providing tinyUSB under MIT license, which covers most of the USB functionality.
14+
15+
16+
== License ==
17+
18+
Copyright (c) Benjamin Aigner <[email protected]> All right reserved.
19+
20+
This library is free software; you can redistribute it and/or
21+
modify it under the terms of the GNU Lesser General Public
22+
License as published by the Free Software Foundation; either
23+
version 2.1 of the License, or (at your option) any later version.
24+
25+
This library is distributed in the hope that it will be useful,
26+
but WITHOUT ANY WARRANTY; without even the implied warranty of
27+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28+
Lesser General Public License for more details.
29+
30+
You should have received a copy of the GNU Lesser General Public
31+
License along with this library; if not, write to the Free Software
32+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

0 commit comments

Comments
 (0)