Skip to content

Commit 72b98a3

Browse files
committed
feat(hid): Update HID-RP submodule and flesh out gamepad reports
* Update HID-RP submodule to have latest changes which include more unit customization * Update hid-rp-gamepad to more closely match xbox 1708 controller descriptor * Update hid-rp-gamepad to have new XboxRumbleOutputReport descriptor * Update hid-rp-gamepad to flesh out led descriptor some more * Update hid_rp_example to include new rumble report * Update hid_service_example to include new rumble report * Update hid_service_example to exercise new consumer record button in gamepad report * Update hid_service_example to add characteristic onWrite callbacks for Rumble and LED, parsing the data that is returned This provides better HID examples and showcases the use of output reports for LED and rumble control. It also updates the examples to better match xbox wireless controller model 1708 for better compatibility. * Build and run `hid-rp/example` on QtPy ESP32s3 and ensure the output matches the 1708 descriptor * Build and run `hid_service/example` on QtPy ESP32s3 and ensure the following work with iPhone: * All gamepad inputs (including new consumer record button) * Battery input report (via game controller settings page) * Rumble output report (by pressing the `identify controller` button in the game controller settings page)
1 parent 2bd8277 commit 72b98a3

File tree

4 files changed

+379
-40
lines changed

4 files changed

+379
-40
lines changed

components/hid-rp/example/main/hid_rp_example.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extern "C" void app_main(void) {
1717
static constexpr uint8_t battery_report_id = 4;
1818
static constexpr size_t num_buttons = 15;
1919
static constexpr int joystick_min = 0;
20-
static constexpr int joystick_max = 65534;
20+
static constexpr int joystick_max = 65535;
2121
static constexpr int trigger_min = 0;
2222
static constexpr int trigger_max = 1023;
2323

@@ -29,15 +29,20 @@ extern "C" void app_main(void) {
2929
using BatteryReport = espp::XboxBatteryInputReport<battery_report_id>;
3030
BatteryReport battery_input_report;
3131

32-
static constexpr uint8_t output_report_id = 2;
32+
static constexpr uint8_t led_output_report_id = 2;
3333
static constexpr size_t num_leds = 4;
34-
using GamepadLeds = espp::GamepadLedOutputReport<num_leds, output_report_id>;
34+
using GamepadLeds = espp::GamepadLedOutputReport<num_leds, led_output_report_id>;
3535
GamepadLeds gamepad_leds_report;
3636

37+
static constexpr uint8_t rumble_output_report_id = 3;
38+
using RumbleReport = espp::XboxRumbleOutputReport<rumble_output_report_id>;
39+
RumbleReport rumble_output_report;
40+
3741
using namespace hid::page;
3842
using namespace hid::rdf;
3943
auto raw_descriptor = descriptor(usage_page<generic_desktop>(), usage(generic_desktop::GAMEPAD),
4044
collection::application(gamepad_input_report.get_descriptor(),
45+
rumble_output_report.get_descriptor(),
4146
battery_input_report.get_descriptor(),
4247
gamepad_leds_report.get_descriptor()));
4348

0 commit comments

Comments
 (0)