feat: preserve native HD rumble on Switch 2 controllers

This commit is contained in:
Joey Yakimowich-Payne 2026-09-07 08:19:53 -06:00
commit 006b573ee8
25 changed files with 1722 additions and 60 deletions

View file

@ -3,6 +3,7 @@
#include <stdbool.h>
#include <stdint.h>
#include "parser/uni_switch2_haptics.h"
#ifdef __cplusplus
extern "C" {
@ -38,6 +39,16 @@ void uni_hid_parser_switch2_parse_input_report(struct uni_hid_device_s* d, const
void uni_hid_parser_switch2_set_player_leds(struct uni_hid_device_s* d, uint8_t leds);
void uni_hid_parser_switch2_play_dual_rumble(struct uni_hid_device_s* d, uint16_t delay_ms, uint16_t duration_ms,
uint8_t weak, uint8_t strong);
// BTstack-core-only host queues. False means unavailable/full: nothing accepted.
// Invalid/stale input is consumed and counted. received_ms is the source clock,
// never a retry timestamp. The callback above is an independent local overlay.
bool uni_hid_parser_switch2_queue_haptics(struct uni_hid_device_s* d,
const uni_switch2_haptics_frame_t* frame, uint32_t received_ms);
bool uni_hid_parser_switch2_queue_rumble(struct uni_hid_device_s* d, uint8_t weak, uint8_t strong,
uint16_t duration_ms, uint32_t received_ms);
void uni_hid_parser_switch2_reset_haptics(struct uni_hid_device_s* d);
// Atomic cumulative transport losses; safe to read without looking up a device.
uint32_t uni_hid_parser_switch2_haptics_dropped(void);
uint8_t uni_hid_parser_switch2_extra_buttons(const struct uni_hid_device_s* d);
// Validated public/static-random advertisement address, never an RPA or SMP identity.
bool uni_hid_parser_switch2_identity_address_type(const struct uni_hid_device_s* d, uint8_t* out);