1818
1919
2020#ifdef __cplusplus
21+ extern " C" {
2122namespace PokemonAutomation {
2223namespace NintendoSwitch {
2324#endif
2425
2526
2627
28+ typedef struct {
29+ uint8_t body[3 ];
30+ uint8_t buttons[3 ];
31+ uint8_t left_grip[3 ];
32+ uint8_t right_grip[3 ];
33+ } ControllerColors;
34+
35+ typedef struct {
36+ uint8_t button3;
37+ uint8_t button4;
38+ uint8_t button5;
39+ uint8_t left_joystick[3 ];
40+ uint8_t right_joystick[3 ];
41+ uint8_t vibrator;
42+ } ButtonState;
43+
44+ typedef struct {
45+ uint8_t data[36 ];
46+ } GyroState;
47+
48+
49+
50+
51+
2752
2853#define PABB_MSG_ESP32_REQUEST_STATUS 0x50
2954typedef struct {
3055 seqnum_t seqnum;
3156} PABB_PACK pabb_esp32_RequestStatus;
3257
3358
59+ #if 0
60+ #define PABB_MSG_ESP32_SET_MAC_ADDRESS 0x61
61+ typedef struct{
62+ seqnum_t seqnum;
63+ uint32_t controller_type;
64+ uint8_t mac_address[6];
65+ } PABB_PACK pabb_esp32_set_mac_address;
66+ #endif
67+
68+
69+ #define PABB_MSG_ESP32_SET_COLORS 0x62
70+ typedef struct {
71+ seqnum_t seqnum;
72+ uint32_t controller_type;
73+ ControllerColors colors;
74+ } PABB_PACK pabb_esp32_set_colors;
75+
76+
77+ #define PABB_MSG_ESP32_CONTROLLER_STATE_BUTTONS 0xa0
78+ typedef struct {
79+ seqnum_t seqnum;
80+ uint16_t milliseconds;
81+ ButtonState buttons;
82+ } PABB_PACK pabb_esp32_controller_state_buttons;
83+
84+
85+ #define PABB_MSG_ESP32_CONTROLLER_STATE_FULL 0xa1
86+ typedef struct {
87+ seqnum_t seqnum;
88+ uint16_t milliseconds;
89+ ButtonState buttons;
90+ GyroState gyro;
91+ } PABB_PACK pabb_esp32_controller_state_full;
3492
3593
3694
95+
96+ // Deprecated
97+
3798typedef struct {
3899 uint8_t report_id;
39100 uint8_t timer;
40101 uint8_t byte2;
41102 uint8_t button3;
42103 uint8_t button4;
43104 uint8_t button5;
44- uint8_t leftstick_x_lo;
45- uint8_t leftstick_x_hi;
46- uint8_t leftstick_y;
47- uint8_t rightstick_x_lo;
48- uint8_t rightstick_x_hi;
49- uint8_t rightstick_y;
105+ uint8_t left_joystick[3 ];
106+ uint8_t right_joystick[3 ];
50107 uint8_t vibrator;
51108 uint8_t gyro[49 - 13 ];
52- } PABB_PACK ESP32Report0x30;
109+ } ESP32Report0x30;
53110
54- #define PABB_MSG_ESP32_REPORT 0x9e
111+
112+ #define PABB_MSG_ESP32_REPORT 0x9e
55113typedef struct {
56114 seqnum_t seqnum;
57115 uint8_t ticks;
@@ -65,6 +123,7 @@ typedef struct{
65123#ifdef __cplusplus
66124}
67125}
126+ }
68127#endif
69128
70129
0 commit comments