Documentation ¶
Index ¶
- Variables
- type Accelerometer
- type Battery
- type Callback
- type ConnectionType
- type Controller
- func (c *Controller) Connect() error
- func (c *Controller) ConnectionType() ConnectionType
- func (c *Controller) Disconnect() error
- func (c *Controller) Led(led *led.Led) error
- func (c *Controller) Listen() error
- func (c *Controller) Name() string
- func (c *Controller) Off(event Event)
- func (c *Controller) On(event Event, fn Callback)
- func (c *Controller) ProductID() uint16
- func (c *Controller) Rumble(rumble *rumble.Rumble) error
- func (c *Controller) String() string
- func (c *Controller) VendorID() uint16
- type Device
- type Event
- type Gyroscope
- type Stick
- type Touch
- type Touchpad
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidConnectionType = errors.New("ds4: can't detect connection type") ErrControllerIsConnected = errors.New("ds4: controller is already connected") ErrControllerIsNotConnected = errors.New("ds4: controller is not connected") ErrControllerIsListening = errors.New("ds4: controller is already listening for events") )
Functions ¶
This section is empty.
Types ¶
type Accelerometer ¶
type ConnectionType ¶
type ConnectionType uint
const ( ConnectionTypeNone ConnectionType = iota ConnectionTypeUSB ConnectionTypeBluetooth )
func (ConnectionType) String ¶
func (t ConnectionType) String() string
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func Find ¶
func Find() []*Controller
func NewController ¶
func NewController(device Device) *Controller
func (*Controller) Connect ¶
func (c *Controller) Connect() error
func (*Controller) ConnectionType ¶
func (c *Controller) ConnectionType() ConnectionType
func (*Controller) Disconnect ¶
func (c *Controller) Disconnect() error
func (*Controller) Listen ¶
func (c *Controller) Listen() error
func (*Controller) Name ¶
func (c *Controller) Name() string
func (*Controller) Off ¶
func (c *Controller) Off(event Event)
func (*Controller) On ¶
func (c *Controller) On(event Event, fn Callback)
func (*Controller) ProductID ¶
func (c *Controller) ProductID() uint16
func (*Controller) String ¶
func (c *Controller) String() string
func (*Controller) VendorID ¶
func (c *Controller) VendorID() uint16
type Event ¶
type Event string
const ( // Cross EventCrossPress Event = "cross.press" EventCrossRelease Event = "cross.release" // Circle EventCirclePress Event = "circle.press" EventCircleRelease Event = "circle.release" // Square EventSquarePress Event = "square.press" EventSquareRelease Event = "square.release" // Triangle EventTrianglePress Event = "triangle.press" EventTriangleRelease Event = "triangle.release" // L1 EventL1Press Event = "l1.press" EventL1Release Event = "l1.release" // L2 EventL2Press Event = "l2.press" EventL2Release Event = "l2.release" // L3 EventL3Press Event = "l3.press" EventL3Release Event = "l3.release" // R1 EventR1Press Event = "r1.press" EventR1Release Event = "r1.release" // R2 EventR2Press Event = "r2.press" EventR2Release Event = "r2.release" // R3 EventR3Press Event = "r3.press" EventR3Release Event = "r3.release" // D-pad up EventDPadUpPress Event = "dpad_up.press" EventDPadUpRelease Event = "dpad_up.release" // D-pad down EventDPadDownPress Event = "dpad_down.press" EventDPadDownRelease Event = "dpad_down.release" // D-pad left EventDPadLeftPress Event = "dpad_left.press" EventDPadLeftRelease Event = "dpad_left.release" // D-pad right EventDPadRightPress Event = "dpad_right.press" EventDPadRightRelease Event = "dpad_right.release" // Share // Options EventOptionsPress Event = "options.press" EventOptionsRelease Event = "options.release" // Touchpad EventTouchpadSwipe Event = "touchpad.swipe" EventTouchpadPress Event = "touchpad.press" EventTouchpadRelease Event = "touchpad.release" // PS EventPSPress Event = "ps.press" EventPSRelease Event = "ps.release" // Left stick EventLeftStickMove Event = "left_stick.move" // Right stick EventRightStickMove Event = "right_stick.move" // Accelerometer EventAccelerometerUpdate Event = "accelerometer.update" // Gyroscope EventGyroscopeUpdate Event = "gyroscope.update" // Battery EventBatteryUpdate Event = "battery.update" )
Click to show internal directories.
Click to hide internal directories.