Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix gamepad examples #76

Merged
merged 1 commit into from
Aug 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
File renamed without changes.
11 changes: 8 additions & 3 deletions examples/hid_joywing_gamepad.py
Expand Up @@ -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):
Expand All @@ -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)

Expand Down
7 changes: 6 additions & 1 deletion 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)

Expand Down