diff --git a/examples/joystick_ps3.go b/examples/joystick_ps3.go index 56946e9f..1d61119a 100644 --- a/examples/joystick_ps3.go +++ b/examples/joystick_ps3.go @@ -13,7 +13,7 @@ import ( func main() { joystickAdaptor := joystick.NewAdaptor() - stick := joystick.NewDriver(joystickAdaptor, "dualshock3") + stick := joystick.NewDriver(joystickAdaptor, joystick.Dualshock3) work := func() { // buttons diff --git a/examples/joystick_ps4.go b/examples/joystick_ps4.go index 34dfebc1..aaaad2e9 100644 --- a/examples/joystick_ps4.go +++ b/examples/joystick_ps4.go @@ -13,7 +13,7 @@ import ( func main() { joystickAdaptor := joystick.NewAdaptor() - stick := joystick.NewDriver(joystickAdaptor, "dualshock4") + stick := joystick.NewDriver(joystickAdaptor, joystick.Dualshock4) work := func() { stick.On(joystick.SquarePress, func(data interface{}) { diff --git a/examples/joystick_xbox360.go b/examples/joystick_xbox360.go index bf94a90b..9f61049f 100644 --- a/examples/joystick_xbox360.go +++ b/examples/joystick_xbox360.go @@ -13,7 +13,7 @@ import ( func main() { joystickAdaptor := joystick.NewAdaptor() - stick := joystick.NewDriver(joystickAdaptor, "xbox360") + stick := joystick.NewDriver(joystickAdaptor, joystick.Xbox360) work := func() { stick.On(joystick.APress, func(data interface{}) { diff --git a/examples/joystick_xbox360_rock_band_drums.go b/examples/joystick_xbox360_rock_band_drums.go index 9f75e92e..1e52bfa6 100644 --- a/examples/joystick_xbox360_rock_band_drums.go +++ b/examples/joystick_xbox360_rock_band_drums.go @@ -13,7 +13,7 @@ import ( func main() { joystickAdaptor := joystick.NewAdaptor() - stick := joystick.NewDriver(joystickAdaptor, "xbox360RockBandDrums") + stick := joystick.NewDriver(joystickAdaptor, joystick.Xbox360RockBandDrums) work := func() { stick.On(joystick.RedPress, func(data interface{}) { diff --git a/platforms/joystick/joystick_driver.go b/platforms/joystick/joystick_driver.go index 0a8481ce..8d08f743 100644 --- a/platforms/joystick/joystick_driver.go +++ b/platforms/joystick/joystick_driver.go @@ -10,6 +10,23 @@ import ( "gobot.io/x/gobot" ) +const ( + // Dualshock3 joystick configuration. + Dualshock3 = "dualshock3" + + // Dualshock4 joystick configuration. + Dualshock4 = "dualshock4" + + // TFlightHotasX flight stick configuration. + TFlightHotasX = "tflightHotasX" + + // Xbox360 joystick configuration. + Xbox360 = "xbox360" + + // Xbox360RockBandDrums controller configuration. + Xbox360RockBandDrums = "xbox360RockBandDrums" +) + // Driver represents a joystick type Driver struct { name string