1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-24 13:48:49 +08:00

Add configuration for Nintendo Switch controllers (#903)

This commit is contained in:
Andrew Regner 2023-03-23 11:14:02 -07:00 committed by GitHub
parent dae7a13514
commit c9a91720ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 126 additions and 0 deletions

View File

@ -9,6 +9,7 @@ Current configurations included:
- Thrustmaster T-Flight Hotas X Joystick
- XBox360 game controller
- XBox360 "Rock Band" drum controller
- Nintendo Switch Joy-Con controller pair
## How to Install

View File

@ -31,6 +31,12 @@ const (
// Configuration for the Xbox One controller.
XboxOne = "xboxOne"
// Nvidia Shield TV Controller
Shield = "shield"
// Nintendo Switch Joycon Controller Pair
NintendoSwitchPair = "joyconPair"
)
// Driver represents a joystick
@ -135,6 +141,10 @@ func (j *Driver) Start() (err error) {
j.config = xbox360RockBandDrumsConfig
case XboxOne:
j.config = xboxOneConfig
case Shield:
j.config = shieldConfig
case NintendoSwitchPair:
j.config = joyconPairConfig
default:
err := j.loadFile()
if err != nil {

View File

@ -0,0 +1,115 @@
package joystick
var joyconPairConfig = joystickConfig{
Name: "Nintendo Switch Joycon Controller Pair",
GUID: "5555",
Axis: []pair{
pair{
Name: "left_x",
ID: 0,
},
pair{
Name: "left_y",
ID: 1,
},
pair{
Name: "right_x",
ID: 2,
},
pair{
Name: "right_y",
ID: 3,
},
pair{
Name: "lt",
ID: 4,
},
pair{
Name: "rt",
ID: 5,
},
},
Buttons: []pair{
pair{
Name: "a",
ID: 0,
},
pair{
Name: "b",
ID: 1,
},
pair{
Name: "x",
ID: 2,
},
pair{
Name: "y",
ID: 3,
},
pair{
Name: "up",
ID: 11,
},
pair{
Name: "down",
ID: 12,
},
pair{
Name: "left",
ID: 13,
},
pair{
Name: "right",
ID: 14,
},
pair{
Name: "lb",
ID: 9,
},
pair{
Name: "rb",
ID: 10,
},
pair{
Name: "right_stick",
ID: 8,
},
pair{
Name: "left_stick",
ID: 7,
},
pair{
Name: "options",
ID: 15,
},
pair{
Name: "home",
ID: 5,
},
pair{
Name: "sr_left",
ID: 17,
},
pair{
Name: "sl_left",
ID: 19,
},
pair{
Name: "sr_right",
ID: 16,
},
pair{
Name: "sl_right",
ID: 18,
},
pair{
Name: "minus",
ID: 4,
},
pair{
Name: "plus",
ID: 6,
},
},
Hats: []hat{},
}