From 2d056b02c77207958fb1c9d72e9cb2cc8068cb1e Mon Sep 17 00:00:00 2001 From: foamyguy Date: Fri, 20 Aug 2021 17:46:42 -0500 Subject: [PATCH] fix gamepad examples --- examples/{gamepad.py => hid_gamepad.py} | 0 examples/hid_joywing_gamepad.py | 11 ++++++++--- examples/hid_simple_gamepad.py | 7 ++++++- 3 files changed, 14 insertions(+), 4 deletions(-) rename examples/{gamepad.py => hid_gamepad.py} (100%) diff --git a/examples/gamepad.py b/examples/hid_gamepad.py similarity index 100% rename from examples/gamepad.py rename to examples/hid_gamepad.py diff --git a/examples/hid_joywing_gamepad.py b/examples/hid_joywing_gamepad.py index 77dfbd0..2473675 100644 --- a/examples/hid_joywing_gamepad.py +++ b/examples/hid_joywing_gamepad.py @@ -5,14 +5,19 @@ # https://www.adafruit.com/product/3632 # https://learn.adafruit.com/joy-featherwing +# You must add a gamepad HID device inside your boot.py file +# in order to use this example. +# See this Learn Guide for details: +# https://learn.adafruit.com/customizing-usb-devices-in-circuitpython/hid-devices#custom-hid-devices-3096614-9 + import time import board import busio from micropython import const -import adafruit_seesaw +from adafruit_seesaw.seesaw import Seesaw import usb_hid -from gamepad import Gamepad +from hid_gamepad import Gamepad def range_map(value, in_min, in_max, out_min, out_max): @@ -34,7 +39,7 @@ def range_map(value, in_min, in_max, out_min, out_max): i2c = busio.I2C(board.SCL, board.SDA) -ss = adafruit_seesaw.Seesaw(i2c) +ss = Seesaw(i2c) ss.pin_mode_bulk(button_mask, ss.INPUT_PULLUP) diff --git a/examples/hid_simple_gamepad.py b/examples/hid_simple_gamepad.py index ff77fa3..614cc84 100644 --- a/examples/hid_simple_gamepad.py +++ b/examples/hid_simple_gamepad.py @@ -1,12 +1,17 @@ # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT +# You must add a gamepad HID device inside your boot.py file +# in order to use this example. +# See this Learn Guide for details: +# https://learn.adafruit.com/customizing-usb-devices-in-circuitpython/hid-devices#custom-hid-devices-3096614-9 + import board import digitalio import analogio import usb_hid -from gamepad import Gamepad +from hid_gamepad import Gamepad gp = Gamepad(usb_hid.devices)