joystick: provide constant values for existing joystick configurations
Signed-off-by: Ron Evans <ron@hybridgroup.com>
This commit is contained in:
parent
c098cacad0
commit
261400d325
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
func main() {
|
||||
joystickAdaptor := joystick.NewAdaptor()
|
||||
stick := joystick.NewDriver(joystickAdaptor, "dualshock3")
|
||||
stick := joystick.NewDriver(joystickAdaptor, joystick.Dualshock3)
|
||||
|
||||
work := func() {
|
||||
// buttons
|
||||
|
|
|
@ -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{}) {
|
||||
|
|
|
@ -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{}) {
|
||||
|
|
|
@ -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{}) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue