- 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.
68 lines
2.1 KiB
C
68 lines
2.1 KiB
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <string.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @brief Unified, normalized controller state representing any gamepad.
|
|
*
|
|
* Analog sticks are scaled to -32768 to 32767 (0 is neutral centered).
|
|
* Triggers are normalized from 0 to 255 (0 is released, 255 is fully depressed).
|
|
*/
|
|
typedef struct {
|
|
/* Analog Axes */
|
|
int16_t lx; /* Left Stick X (-32768 to 32767) */
|
|
int16_t ly; /* Left Stick Y (-32768 to 32767, up is positive) */
|
|
int16_t rx; /* Right Stick X (-32768 to 32767) */
|
|
int16_t ry; /* Right Stick Y (-32768 to 32767, up is positive) */
|
|
|
|
/* Analog Triggers */
|
|
uint8_t lt; /* Left Trigger (0 to 255) */
|
|
uint8_t rt; /* Right Trigger (0 to 255) */
|
|
|
|
/* D-Pad Buttons */
|
|
uint8_t dpad_up : 1;
|
|
uint8_t dpad_down : 1;
|
|
uint8_t dpad_left : 1;
|
|
uint8_t dpad_right : 1;
|
|
|
|
/* Face Buttons */
|
|
uint8_t btn_a : 1; /* South (Xbox A, Switch B, PS Cross) */
|
|
uint8_t btn_b : 1; /* East (Xbox B, Switch A, PS Circle) */
|
|
uint8_t btn_x : 1; /* West (Xbox X, Switch Y, PS Square) */
|
|
uint8_t btn_y : 1; /* North (Xbox Y, Switch X, PS Triangle) */
|
|
|
|
/* Shoulder & Trigger Digital Buttons */
|
|
uint8_t btn_lb : 1; /* Left Bumper / L1 / L */
|
|
uint8_t btn_rb : 1; /* Right Bumper / R1 / R */
|
|
uint8_t btn_lt : 1; /* Left Trigger digital click / ZL */
|
|
uint8_t btn_rt : 1; /* Right Trigger digital click / ZR */
|
|
|
|
/* Special & Navigation Buttons */
|
|
uint8_t btn_select : 1; /* Back / View / Minus / Select */
|
|
uint8_t btn_start : 1; /* Start / Menu / Plus */
|
|
uint8_t btn_l3 : 1; /* Left Thumbstick Click */
|
|
uint8_t btn_r3 : 1; /* Right Thumbstick Click */
|
|
uint8_t btn_system : 1; /* Xbox Guide / PS / Switch Home */
|
|
uint8_t btn_share : 1; /* Share / Capture */
|
|
} controller_state_t;
|
|
|
|
/**
|
|
* @brief Reset controller state to neutral rest position.
|
|
*/
|
|
static inline void controller_state_reset(controller_state_t *state)
|
|
{
|
|
if (state) {
|
|
memset(state, 0, sizeof(controller_state_t));
|
|
}
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|