Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
72 lines
1.8 KiB
C
72 lines
1.8 KiB
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#define SWITCH_PRO_HAT_UP 0x00
|
|
#define SWITCH_PRO_HAT_UPRIGHT 0x01
|
|
#define SWITCH_PRO_HAT_RIGHT 0x02
|
|
#define SWITCH_PRO_HAT_DOWNRIGHT 0x03
|
|
#define SWITCH_PRO_HAT_DOWN 0x04
|
|
#define SWITCH_PRO_HAT_DOWNLEFT 0x05
|
|
#define SWITCH_PRO_HAT_LEFT 0x06
|
|
#define SWITCH_PRO_HAT_UPLEFT 0x07
|
|
#define SWITCH_PRO_HAT_NOTHING 0x08
|
|
|
|
#define SWITCH_PRO_MASK_Y (1U << 0)
|
|
#define SWITCH_PRO_MASK_B (1U << 1)
|
|
#define SWITCH_PRO_MASK_A (1U << 2)
|
|
#define SWITCH_PRO_MASK_X (1U << 3)
|
|
#define SWITCH_PRO_MASK_L (1U << 4)
|
|
#define SWITCH_PRO_MASK_R (1U << 5)
|
|
#define SWITCH_PRO_MASK_ZL (1U << 6)
|
|
#define SWITCH_PRO_MASK_ZR (1U << 7)
|
|
#define SWITCH_PRO_MASK_MINUS (1U << 8)
|
|
#define SWITCH_PRO_MASK_PLUS (1U << 9)
|
|
#define SWITCH_PRO_MASK_L3 (1U << 10)
|
|
#define SWITCH_PRO_MASK_R3 (1U << 11)
|
|
#define SWITCH_PRO_MASK_HOME (1U << 12)
|
|
#define SWITCH_PRO_MASK_CAPTURE (1U << 13)
|
|
|
|
#define SWITCH_PRO_JOYSTICK_MIN 0x0000
|
|
#define SWITCH_PRO_JOYSTICK_MID 0x7FFF
|
|
#define SWITCH_PRO_JOYSTICK_MAX 0xFFFF
|
|
|
|
typedef struct {
|
|
int16_t accel_x;
|
|
int16_t accel_y;
|
|
int16_t accel_z;
|
|
int16_t gyro_x;
|
|
int16_t gyro_y;
|
|
int16_t gyro_z;
|
|
} SwitchImuSample;
|
|
|
|
typedef struct {
|
|
bool dpad_up;
|
|
bool dpad_down;
|
|
bool dpad_left;
|
|
bool dpad_right;
|
|
|
|
bool button_a;
|
|
bool button_b;
|
|
bool button_x;
|
|
bool button_y;
|
|
bool button_l;
|
|
bool button_r;
|
|
bool button_zl;
|
|
bool button_zr;
|
|
bool button_plus;
|
|
bool button_minus;
|
|
bool button_home;
|
|
bool button_capture;
|
|
bool button_l3;
|
|
bool button_r3;
|
|
|
|
uint16_t lx;
|
|
uint16_t ly;
|
|
uint16_t rx;
|
|
uint16_t ry;
|
|
|
|
uint8_t imu_sample_count;
|
|
SwitchImuSample imu_samples[3];
|
|
} SwitchInputState;
|