Skip to content

Commit

Permalink
adds small correction to Super Nintendo USB controller guide
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertDaleSmith committed Oct 5, 2023
1 parent f316859 commit 9525487
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Super_Nintendo_USB_Controller/boot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SPDX-FileCopyrightText: 2023 Robert Dale Smith for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
# SPDX-License-Identifier: MIT
# USB HID descriptor for generic DirectInput compatible gamepad.

import usb_hid

Expand Down Expand Up @@ -67,7 +68,7 @@
usage_page=0x01, # Generic Desktop Control
usage=0x05, # Gamepad
report_ids=(0,), # Descriptor uses report ID 0.
in_report_lengths=(19,), # This gamepad sends 6 bytes in its report.
in_report_lengths=(19,), # This gamepad sends 19 bytes in its report.
out_report_lengths=(0,), # It does not receive any reports.
)

Expand Down
5 changes: 5 additions & 0 deletions Super_Nintendo_USB_Controller/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ def read_snes_controller():

report = bytearray(19)
report[2] = 0x08 # default released hat switch value
report[3] = 127 # default x center value
report[4] = 127 # default y center value
report[5] = 127 # default z center value
report[6] = 127 # default rz center value

prev_report = bytearray(report)

while True:
Expand Down

0 comments on commit 9525487

Please sign in to comment.