Skip to content

Commit 246e263

Browse files
committed
Rename Wireless to OEM.
1 parent 6272a90 commit 246e263

18 files changed

+383
-372
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/* Nintendo Switch - OEM Controller State
2+
*
3+
* From: https://github.com/PokemonAutomation/
4+
*
5+
*/
6+
7+
8+
#include <string.h>
9+
#include "NintendoSwitch_OemController_State.h"
10+
11+
12+
const pabb_NintendoSwitch_Rumble pabb_NintendoSwitch_Rumble_NEUTRAL_STATE = {
13+
.left = {0x00, 0x01, 0x40, 0x40},
14+
.right = {0x00, 0x01, 0x40, 0x40},
15+
};
16+
17+
18+
const pabb_NintendoSwitch_OemController_State0x30 pabb_NintendoSwitch_OemController_State0x30_NEUTRAL_STATE = {
19+
.buttons = {
20+
.button3 = 0,
21+
.button4 = 0,
22+
.button5 = 0,
23+
.left_joystick = {0x00, 0x08, 0x80},
24+
.right_joystick = {0x00, 0x08, 0x80},
25+
.vibrator = 0x00,
26+
},
27+
};
28+
29+
bool pabb_NintendoSwitch_OemController_State0x30_equals(
30+
const pabb_NintendoSwitch_OemController_State0x30* state0,
31+
const pabb_NintendoSwitch_OemController_State0x30* state1
32+
){
33+
return memcmp(state0, state1, sizeof(pabb_NintendoSwitch_OemController_State0x30)) == 0;
34+
}
35+
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/* Nintendo Switch - OEM Controller State
2+
*
3+
* From: https://github.com/PokemonAutomation/
4+
*
5+
*/
6+
7+
#ifndef PokemonAutomation_NintendoSwitch_OemController_State_H
8+
#define PokemonAutomation_NintendoSwitch_OemController_State_H
9+
10+
#include <stdbool.h>
11+
#include <stdint.h>
12+
13+
#ifdef __cplusplus
14+
extern "C" {
15+
#endif
16+
17+
18+
typedef struct{
19+
uint8_t left[4];
20+
uint8_t right[4];
21+
} pabb_NintendoSwitch_Rumble;
22+
23+
extern const pabb_NintendoSwitch_Rumble pabb_NintendoSwitch_Rumble_NEUTRAL_STATE;
24+
25+
26+
27+
typedef struct{
28+
uint8_t button3;
29+
uint8_t button4;
30+
uint8_t button5;
31+
uint8_t left_joystick[3];
32+
uint8_t right_joystick[3];
33+
uint8_t vibrator;
34+
} pabb_NintendoSwitch_OemController_State0x30_Buttons;
35+
36+
typedef struct{
37+
int16_t accel_x;
38+
int16_t accel_y;
39+
int16_t accel_z;
40+
int16_t rotation_x;
41+
int16_t rotation_y;
42+
int16_t rotation_z;
43+
} pabb_NintendoSwitch_OemController_State0x30_Gyro;
44+
45+
typedef struct{
46+
pabb_NintendoSwitch_OemController_State0x30_Gyro time0;
47+
pabb_NintendoSwitch_OemController_State0x30_Gyro time1;
48+
pabb_NintendoSwitch_OemController_State0x30_Gyro time2;
49+
} pabb_NintendoSwitch_OemController_State0x30_GyroX3;
50+
51+
typedef struct{
52+
pabb_NintendoSwitch_OemController_State0x30_Buttons buttons;
53+
pabb_NintendoSwitch_OemController_State0x30_GyroX3 gyro;
54+
} pabb_NintendoSwitch_OemController_State0x30;
55+
56+
57+
58+
59+
extern const pabb_NintendoSwitch_OemController_State0x30 pabb_NintendoSwitch_OemController_State0x30_NEUTRAL_STATE;
60+
61+
bool pabb_NintendoSwitch_OemController_State0x30_equals(
62+
const pabb_NintendoSwitch_OemController_State0x30* state0,
63+
const pabb_NintendoSwitch_OemController_State0x30* state1
64+
);
65+
66+
67+
68+
#ifdef __cplusplus
69+
}
70+
#endif
71+
#endif

Common/ControllerStates/NintendoSwitch_WirelessController_State.c

Lines changed: 0 additions & 35 deletions
This file was deleted.

Common/ControllerStates/NintendoSwitch_WirelessController_State.h

Lines changed: 0 additions & 71 deletions
This file was deleted.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/* SerialPABotBase Messages (Nintendo Switch 1 OEM Controllers)
2+
*
3+
* From: https://github.com/PokemonAutomation/
4+
*
5+
*/
6+
7+
#ifndef PokemonAutomation_SerialPABotBase_Messages_NS1_OemControllers_H
8+
#define PokemonAutomation_SerialPABotBase_Messages_NS1_OemControllers_H
9+
10+
#include "../ControllerStates/NintendoSwitch_OemController_State.h"
11+
#include "SerialPABotBase_Protocol.h"
12+
13+
#if _WIN32
14+
#pragma pack(push, 1)
15+
#define PABB_PACK
16+
#elif __GNUC__
17+
#define PABB_PACK __attribute__((packed))
18+
#else
19+
#define PABB_PACK
20+
#endif
21+
22+
23+
#ifdef __cplusplus
24+
extern "C" {
25+
#endif
26+
27+
28+
29+
typedef struct{
30+
uint8_t body[3];
31+
uint8_t buttons[3];
32+
uint8_t left_grip[3];
33+
uint8_t right_grip[3];
34+
} PABB_NintendoSwitch_ControllerColors;
35+
36+
37+
38+
39+
40+
#define PABB_MSG_INFO_NS1_OEM_CONTROLLER_RUMBLE 0x30
41+
typedef struct{
42+
pabb_NintendoSwitch_Rumble rumble;
43+
} PABB_PACK pabb_MsgInfo_NS1_OemController_Rumble;
44+
45+
46+
47+
#define PABB_MSG_REQUEST_NS1_OEM_CONTROLLER_READ_SPI 0x60
48+
typedef struct{
49+
seqnum_t seqnum;
50+
uint32_t controller_type;
51+
uint32_t address;
52+
uint8_t bytes;
53+
} PABB_PACK pabb_Message_NS1_OemController_ReadSpi;
54+
55+
#define PABB_MSG_REQUEST_NS1_OEM_CONTROLLER_WRITE_SPI 0x61
56+
typedef struct{
57+
seqnum_t seqnum;
58+
uint32_t controller_type;
59+
uint32_t address;
60+
uint8_t bytes;
61+
} PABB_PACK pabb_Message_NS1_OemController_WriteSpi;
62+
63+
64+
65+
#define PABB_MSG_COMMAND_NS1_OEM_CONTROLLER_BUTTONS 0xa0
66+
typedef struct{
67+
seqnum_t seqnum;
68+
uint16_t milliseconds;
69+
pabb_NintendoSwitch_OemController_State0x30_Buttons buttons;
70+
} PABB_PACK pabb_Message_Command_NS1_OemController_Buttons;
71+
72+
73+
#define PABB_MSG_COMMAND_NS1_OEM_CONTROLLER_FULL_STATE 0xa1
74+
typedef struct{
75+
seqnum_t seqnum;
76+
uint16_t milliseconds;
77+
pabb_NintendoSwitch_OemController_State0x30 state;
78+
} PABB_PACK pabb_Message_Command_NS1_OemController_FullState;
79+
80+
81+
82+
83+
#ifdef __cplusplus
84+
}
85+
#endif
86+
87+
88+
89+
#if _WIN32
90+
#pragma pack(pop)
91+
#endif
92+
93+
94+
#endif

0 commit comments

Comments
 (0)