- 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.
90 lines
2.5 KiB
C
90 lines
2.5 KiB
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include "controller_state.h"
|
|
#include "esp_err.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef enum {
|
|
CONSOLE_MODE_SWITCH = 0, /* Nintendo Switch (HORI Pokken Pad) */
|
|
CONSOLE_MODE_PC_DINPUT = 1, /* PC DirectInput / Generic Gamepad */
|
|
CONSOLE_MODE_PS3 = 2, /* PS3 Controller */
|
|
CONSOLE_MODE_XBOX360 = 3, /* Xbox 360 Controller (XInput + XSM3) */
|
|
CONSOLE_MODE_XBOXOG = 4, /* Original Xbox (Controller S / XID) */
|
|
CONSOLE_MODE_PS4 = 5, /* PlayStation 4 (DualShock 4 / DS4) */
|
|
CONSOLE_MODE_MOUSE_KB = 6, /* Couch Mouse & Keyboard (Media + Cursor) */
|
|
CONSOLE_MODE_MAX
|
|
} console_mode_t;
|
|
|
|
typedef void (*profile_change_cb_t)(console_mode_t new_mode);
|
|
|
|
/**
|
|
* @brief Initialize profile manager (loads saved mode from NVS, sets up BOOT button).
|
|
*/
|
|
esp_err_t profile_manager_init(profile_change_cb_t callback);
|
|
|
|
/**
|
|
* @brief Get the currently active console mode.
|
|
*/
|
|
console_mode_t profile_manager_get_mode(void);
|
|
|
|
/**
|
|
* @brief Set the active console mode and save to NVS.
|
|
*/
|
|
esp_err_t profile_manager_set_mode(console_mode_t mode);
|
|
|
|
/**
|
|
* @brief Cycle to the next console mode.
|
|
*/
|
|
void profile_manager_cycle_mode(void);
|
|
|
|
/**
|
|
* @brief Process controller state to detect button combos for mode switching.
|
|
*/
|
|
void profile_manager_process_state(const controller_state_t *state);
|
|
|
|
/**
|
|
* @brief Get string name of the mode.
|
|
*/
|
|
const char *profile_manager_mode_name(console_mode_t mode);
|
|
|
|
/**
|
|
* @brief Set LED brightness (0 - 100%) and persist to NVS.
|
|
*/
|
|
esp_err_t profile_manager_set_led_brightness(uint8_t percent);
|
|
|
|
/**
|
|
* @brief Get saved LED brightness.
|
|
*/
|
|
uint8_t profile_manager_get_led_brightness(void);
|
|
|
|
/**
|
|
* @brief Refresh LED color for active profile (e.g. after exiting config portal).
|
|
*/
|
|
void profile_manager_refresh_led(void);
|
|
|
|
typedef struct {
|
|
int8_t combo_a; /* Target console_mode_t for START + A (South / Cross), or -1 for disabled */
|
|
int8_t combo_b; /* Target console_mode_t for START + B (East / Circle), or -1 for disabled */
|
|
int8_t combo_x; /* Target console_mode_t for START + X (West / Square), or -1 for disabled */
|
|
int8_t combo_y; /* Target console_mode_t for START + Y (North / Triangle), or -1 for disabled */
|
|
} combo_config_t;
|
|
|
|
/**
|
|
* @brief Get current button combo configuration.
|
|
*/
|
|
void profile_manager_get_combos(combo_config_t *combos);
|
|
|
|
/**
|
|
* @brief Set button combo configuration and persist to NVS.
|
|
*/
|
|
esp_err_t profile_manager_set_combos(const combo_config_t *combos);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|