Skip to content

Commit

Permalink
Merge pull request #76 from FoamyGuy/rename_gamepad_example
Browse files Browse the repository at this point in the history
fix gamepad examples
  • Loading branch information
dhalbert committed Aug 21, 2021
2 parents d5b6ea5 + 2d056b0 commit 59c3465
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
File renamed without changes.
11 changes: 8 additions & 3 deletions examples/hid_joywing_gamepad.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 59c3465

Please sign in to comment.