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() {
|
func main() {
|
||||||
joystickAdaptor := joystick.NewAdaptor()
|
joystickAdaptor := joystick.NewAdaptor()
|
||||||
stick := joystick.NewDriver(joystickAdaptor, "dualshock3")
|
stick := joystick.NewDriver(joystickAdaptor, joystick.Dualshock3)
|
||||||
|
|
||||||
work := func() {
|
work := func() {
|
||||||
// buttons
|
// buttons
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
joystickAdaptor := joystick.NewAdaptor()
|
joystickAdaptor := joystick.NewAdaptor()
|
||||||
stick := joystick.NewDriver(joystickAdaptor, "dualshock4")
|
stick := joystick.NewDriver(joystickAdaptor, joystick.Dualshock4)
|
||||||
|
|
||||||
work := func() {
|
work := func() {
|
||||||
stick.On(joystick.SquarePress, func(data interface{}) {
|
stick.On(joystick.SquarePress, func(data interface{}) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
joystickAdaptor := joystick.NewAdaptor()
|
joystickAdaptor := joystick.NewAdaptor()
|
||||||
stick := joystick.NewDriver(joystickAdaptor, "xbox360")
|
stick := joystick.NewDriver(joystickAdaptor, joystick.Xbox360)
|
||||||
|
|
||||||
work := func() {
|
work := func() {
|
||||||
stick.On(joystick.APress, func(data interface{}) {
|
stick.On(joystick.APress, func(data interface{}) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
joystickAdaptor := joystick.NewAdaptor()
|
joystickAdaptor := joystick.NewAdaptor()
|
||||||
stick := joystick.NewDriver(joystickAdaptor, "xbox360RockBandDrums")
|
stick := joystick.NewDriver(joystickAdaptor, joystick.Xbox360RockBandDrums)
|
||||||
|
|
||||||
work := func() {
|
work := func() {
|
||||||
stick.On(joystick.RedPress, func(data interface{}) {
|
stick.On(joystick.RedPress, func(data interface{}) {
|
||||||
|
|
|
@ -10,6 +10,23 @@ import (
|
||||||
"gobot.io/x/gobot"
|
"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
|
// Driver represents a joystick
|
||||||
type Driver struct {
|
type Driver struct {
|
||||||
name string
|
name string
|
||||||
|
|
Loading…
Reference in New Issue