Skip to content

Commit

Permalink
Add configuration for Nvidia Shield Controller
Browse files Browse the repository at this point in the history
  • Loading branch information
mike1808 authored and deadprogram committed Nov 27, 2020
1 parent 111b5c6 commit 8cbd0ea
Show file tree
Hide file tree
Showing 3 changed files with 213 additions and 0 deletions.
103 changes: 103 additions & 0 deletions platforms/joystick/configs/sheild.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"name": "Nvidia SHIELD Controller",
"guid": "30001983600083000100",
"hats": [
{
"hat": 0,
"name": "down",
"id": 4
},
{
"hat": 0,
"name": "up",
"id": 1
},
{
"hat": 0,
"name": "left",
"id": 8
},
{
"hat": 0,
"name": "right",
"id": 2
},
{
"hat": 0,
"name": "released",
"id": 0
}
],
"axis": [
{
"name": "left_x",
"id": 0
},
{
"name": "left_y",
"id": 1
},
{
"name": "right_x",
"id": 2
},
{
"name": "right_y",
"id": 3
},
{
"name": "rt",
"id": 4
},
{
"name": "lt",
"id": 5
}
],
"buttons": [
{
"name": "x",
"id": 2
},
{
"name": "a",
"id": 0
},
{
"name": "b",
"id": 1
},
{
"name": "y",
"id": 3
},
{
"name": "lb",
"id": 4
},
{
"name": "rb",
"id": 5
},
{
"name": "back",
"id": 14
},
{
"name": "start",
"id": 7
},
{
"name": "home",
"id": 15
},
{
"name": "right_stick",
"id": 9
},
{
"name": "left_stick",
"id": 8
}
]
}
5 changes: 5 additions & 0 deletions platforms/joystick/joystick_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ const (

// Xbox360RockBandDrums controller configuration.
Xbox360RockBandDrums = "xbox360RockBandDrums"

// Nvidia Shield TV Controller
Shield = "shield"
)

// Driver represents a joystick
Expand Down Expand Up @@ -123,6 +126,8 @@ func (j *Driver) Start() (err error) {
j.config = xbox360Config
case "xbox360RockBandDrums":
j.config = xbox360RockBandDrumsConfig
case "shield":
j.config = shieldConfig
default:
err := j.loadFile()
if err != nil {
Expand Down
105 changes: 105 additions & 0 deletions platforms/joystick/joystick_shield.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
package joystick

var shieldConfig = joystickConfig{
Name: "Nvidia SHIELD Controller",
GUID: "3333",
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: "rt",
ID: 4,
},
pair{
Name: "lt",
ID: 5,
},
},
Buttons: []pair{
pair{
Name: "x",
ID: 2,
},
pair{
Name: "a",
ID: 0,
},
pair{
Name: "b",
ID: 1,
},
pair{
Name: "y",
ID: 3,
},
pair{
Name: "lb",
ID: 4,
},
pair{
Name: "rb",
ID: 5,
},
pair{
Name: "back",
ID: 14,
},
pair{
Name: "start",
ID: 7,
},
pair{
Name: "home",
ID: 15,
},
pair{
Name: "right_stick",
ID: 8,
},
pair{
Name: "left_stick",
ID: 9,
},
},
Hats: []hat{
hat{
Hat: 0,
Name: "down",
ID: 4,
},
hat{
Hat: 0,
Name: "up",
ID: 1,
},
hat{
Hat: 0,
Name: "left",
ID: 8,
},
hat{
Hat: 0,
Name: "right",
ID: 2,
},
hat{
Hat: 0,
Name: "released",
ID: 0,
},
},
}

0 comments on commit 8cbd0ea

Please sign in to comment.