- Dual-Core Architecture: Dedicated 1000Hz USB gaming pipeline on Core 1 and BLE/Wi-Fi/Web telemetry on Core 0. - Multi-Input BLE Host: Parsers for Xbox Wireless, Google Stadia, 8BitDo (Ultimate/Pro2/SN30), and Generic HOGP gamepads. - Multi-Console USB Emulation: Nintendo Switch, PC DirectInput, PS3, PS4, Xbox 360 (libxsm3 cryptographic challenge-response), Original Xbox, and Couch Mouse/Keyboard. - Onboard Web Portal & Captive Portal: Real-time SVG gamepad visualizer, stick deadzone calibration, button combo remapping, and Wi-Fi manager. - Low-Latency Radio Management: Interactive SoftAP toggle to drop to 0-latency gaming mode. - Dual OTA Firmware Flashing: Browser-based wireless firmware updater and automated Python OTA script. - Strict Build Quality: Clean build under -Wall -Wextra with zero warnings or errors. - Versioning & Licensing: Semantic Versioning v1.0.0 and GNU GPLv3 with Commercial Restrictions.
97 lines
3.3 KiB
C
97 lines
3.3 KiB
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include "tusb.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define SWITCH_VID 0x0F0D /* HORI Co., Ltd. */
|
|
#define SWITCH_PID 0x0092 /* POKKEN TOURNAMENT DX Pro Pad (Plug & Play on Switch/PC/PS3) */
|
|
|
|
/* Button Bitmasks for Switch */
|
|
#define SWITCH_BTN_Y (1 << 0)
|
|
#define SWITCH_BTN_B (1 << 1)
|
|
#define SWITCH_BTN_A (1 << 2)
|
|
#define SWITCH_BTN_X (1 << 3)
|
|
#define SWITCH_BTN_L (1 << 4)
|
|
#define SWITCH_BTN_R (1 << 5)
|
|
#define SWITCH_BTN_ZL (1 << 6)
|
|
#define SWITCH_BTN_ZR (1 << 7)
|
|
#define SWITCH_BTN_MINUS (1 << 8)
|
|
#define SWITCH_BTN_PLUS (1 << 9)
|
|
#define SWITCH_BTN_LCLICK (1 << 10)
|
|
#define SWITCH_BTN_RCLICK (1 << 11)
|
|
#define SWITCH_BTN_HOME (1 << 12)
|
|
#define SWITCH_BTN_CAPTURE (1 << 13)
|
|
|
|
#define SWITCH_HAT_UP 0
|
|
#define SWITCH_HAT_UP_RIGHT 1
|
|
#define SWITCH_HAT_RIGHT 2
|
|
#define SWITCH_HAT_DOWN_RIGHT 3
|
|
#define SWITCH_HAT_DOWN 4
|
|
#define SWITCH_HAT_DOWN_LEFT 5
|
|
#define SWITCH_HAT_LEFT 6
|
|
#define SWITCH_HAT_UP_LEFT 7
|
|
#define SWITCH_HAT_CENTER 8
|
|
|
|
typedef struct __attribute__((packed)) {
|
|
uint16_t buttons;
|
|
uint8_t hat;
|
|
uint8_t lx;
|
|
uint8_t ly;
|
|
uint8_t rx;
|
|
uint8_t ry;
|
|
uint8_t vendor;
|
|
} switch_report_t;
|
|
|
|
/* Standard Switch Pokken Pad HID Report Descriptor */
|
|
static const uint8_t switch_hid_report_descriptor[] = {
|
|
0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
|
|
0x09, 0x05, // Usage (Game Pad)
|
|
0xA1, 0x01, // Collection (Application)
|
|
0x15, 0x00, // Logical Minimum (0)
|
|
0x25, 0x01, // Logical Maximum (1)
|
|
0x35, 0x00, // Physical Minimum (0)
|
|
0x45, 0x01, // Physical Maximum (1)
|
|
0x75, 0x01, // Report Size (1)
|
|
0x95, 0x10, // Report Count (16)
|
|
0x05, 0x09, // Usage Page (Button)
|
|
0x19, 0x01, // Usage Minimum (0x01)
|
|
0x29, 0x10, // Usage Maximum (0x10)
|
|
0x81, 0x02, // Input (Data,Var,Abs)
|
|
0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
|
|
0x25, 0x07, // Logical Maximum (7)
|
|
0x46, 0x3B, 0x01, // Physical Maximum (315)
|
|
0x75, 0x04, // Report Size (4)
|
|
0x95, 0x01, // Report Count (1)
|
|
0x65, 0x14, // Unit (System: English Rotation)
|
|
0x09, 0x39, // Usage (Hat switch)
|
|
0x81, 0x42, // Input (Data,Var,Abs,Null State)
|
|
0x65, 0x00, // Unit (None)
|
|
0x95, 0x01, // Report Count (1)
|
|
0x81, 0x01, // Input (Const,Array,Abs)
|
|
0x26, 0xFF, 0x00, // Logical Maximum (255)
|
|
0x46, 0xFF, 0x00, // Physical Maximum (255)
|
|
0x09, 0x30, // Usage (X)
|
|
0x09, 0x31, // Usage (Y)
|
|
0x09, 0x32, // Usage (Z)
|
|
0x09, 0x35, // Usage (Rz)
|
|
0x75, 0x08, // Report Size (8)
|
|
0x95, 0x04, // Report Count (4)
|
|
0x81, 0x02, // Input (Data,Var,Abs)
|
|
0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00)
|
|
0x09, 0x20, // Usage (0x20)
|
|
0x95, 0x01, // Report Count (1)
|
|
0x81, 0x02, // Input (Data,Var,Abs)
|
|
0x0A, 0x21, 0x26, // Usage (0x2621)
|
|
0x95, 0x08, // Report Count (8)
|
|
0x91, 0x02, // Output (Data,Var,Abs)
|
|
0xC0 // End Collection
|
|
};
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|