mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 22:13:39 +00:00
Add USB HID joystick support (#3366)
machine/usb: add USB HID joystick support
This commit is contained in:
@@ -14,10 +14,11 @@ var (
|
||||
)
|
||||
|
||||
const (
|
||||
hidEndpoint = 4
|
||||
hidEndpoint = usb.HID_ENDPOINT_IN
|
||||
|
||||
usb_SET_REPORT_TYPE = 33
|
||||
usb_SET_IDLE = 10
|
||||
REPORT_TYPE_INPUT = 1
|
||||
REPORT_TYPE_OUTPUT = 2
|
||||
REPORT_TYPE_FEATURE = 3
|
||||
)
|
||||
|
||||
type hidDevicer interface {
|
||||
@@ -51,7 +52,7 @@ func handler() {
|
||||
|
||||
func setupHandler(setup usb.Setup) bool {
|
||||
ok := false
|
||||
if setup.BmRequestType == usb_SET_REPORT_TYPE && setup.BRequest == usb_SET_IDLE {
|
||||
if setup.BmRequestType == usb.SET_REPORT_TYPE && setup.BRequest == usb.SET_IDLE {
|
||||
machine.SendZlp()
|
||||
ok = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user