1212#if _WIN32
1313#pragma pack(push, 1)
1414#define PABB_PACK
15- #else
15+ #elif __GNUC__
1616#define PABB_PACK __attribute__((packed))
17+ #else
18+ #define PABB_PACK
1719#endif
1820
1921
@@ -28,7 +30,7 @@ typedef struct{
2830 uint8_t buttons [3 ];
2931 uint8_t left_grip [3 ];
3032 uint8_t right_grip [3 ];
31- } PABB_ESP32_NintendoSwitch_ControllerColors ;
33+ } PABB_NintendoSwitch_ControllerColors ;
3234
3335typedef struct {
3436 uint8_t button3 ;
@@ -37,11 +39,22 @@ typedef struct{
3739 uint8_t left_joystick [3 ];
3840 uint8_t right_joystick [3 ];
3941 uint8_t vibrator ;
40- } PABB_ESP32_NintendoSwitch_ButtonState ;
42+ } PABB_NintendoSwitch_ButtonState ;
43+
44+ typedef struct {
45+ uint16_t accel_x ;
46+ uint16_t accel_y ;
47+ uint16_t accel_z ;
48+ uint16_t rotation_x ;
49+ uint16_t rotation_y ;
50+ uint16_t rotation_z ;
51+ } PABB_NintendoSwitch_GyroState ;
4152
4253typedef struct {
43- uint8_t data [36 ];
44- } PABB_ESP32_NintendoSwitch_GyroState ;
54+ PABB_NintendoSwitch_GyroState time0 ;
55+ PABB_NintendoSwitch_GyroState time1 ;
56+ PABB_NintendoSwitch_GyroState time2 ;
57+ } PABB_NintendoSwitch_GyroStateX3 ;
4558
4659
4760
@@ -77,16 +90,16 @@ typedef struct{
7790typedef struct {
7891 seqnum_t seqnum ;
7992 uint16_t milliseconds ;
80- PABB_ESP32_NintendoSwitch_ButtonState buttons ;
93+ PABB_NintendoSwitch_ButtonState buttons ;
8194} PABB_PACK pabb_Message_ESP32_CommandButtonState ;
8295
8396
8497#define PABB_MSG_ESP32_CONTROLLER_STATE_FULL 0xa1
8598typedef struct {
8699 seqnum_t seqnum ;
87100 uint16_t milliseconds ;
88- PABB_ESP32_NintendoSwitch_ButtonState buttons ;
89- PABB_ESP32_NintendoSwitch_GyroState gyro ;
101+ PABB_NintendoSwitch_ButtonState buttons ;
102+ PABB_NintendoSwitch_GyroStateX3 gyro ;
90103} PABB_PACK pabb_Message_ESP32_CommandFullState ;
91104
92105
0 commit comments