Skip to main content

Gamecraft Alt-Controller-Jam 2023 Code

Project description

CTRL.ALT GameCraft 2023

Repo holding the hardware and code behind the controller components used in https://www.gamecraft.it/events/altctrljam-2023/

Hardware

Button pad hardware render

A Raspberry Pi Pico running CircuitPython acts as a HID keyboard device.

Two (or more) button pads are connected to the Pico using jumper cables. Each button pad has 4 buttons.

You can position these anywhere you want on an alternative controller. Embed them in cardboard, stick onto things, etc.

KiCad is used to design the boards. You can even see me following the tutorial in kicad-tutorial!

JLCPCB was used to print the boards. Elbow grease and lots of solder was used to assemble the boards.

The schematics can be found in dpad.

Software

The Pico runs CircuitPython and uses Adafruit's HID library to emulate a keyboard. It's also possible to emulate a mouse and a gamepad (there are some experiments for gamepad emulation in experiments).

Code execution order:

  1. boot.py is run once on board startup to configure it. Here we enable keyboard emulation. If you change this you need to unplug and plug the board back in. If you want to pretend to be a mouse or gamepad this is where you do it.
  2. Next code.py is run to configure the button mapping and listen for events. Editing this should immediately restart the code and use your changes. If you need to change the button mappings this is where you do it.

When running the library code lives in lib on the pico but lives in src here in GitHub.

Building and Deploying to a Pico

just is used to run the build and deployment steps.

poetry is used to manage local tool dependencies. It's also used to install libraries into your development environment, but these won't allow you to run the code on your desktop. They're primarily intended to allow for error checking.

Note that the default paths in the justfile are Apple Mac defaults, you'll need to adjust them for your machine.

  1. To install dependencies: poetry install
  2. To build: just build
  3. To flash CircuitPython onto a Pico:
    1. Hold down the bootsel button on the Pico while plugging in the USB cable into your machine
    2. Keep holding it down until a RPI-RP2 disk is mounted
    3. Run just install-firmware
  4. To deploy the built code onto the pico: just deploy

You can make this process a little more efficient using:

  1. Run just watch to see which disk is mounted
  2. After plugging in the pico use just install-firmware && just deploy && just eject in another terminal to flash the firmware and install the code in one step.

Setting Up

If you're using mise it should activate automatically.

Otherwise you need uv and just installed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gamecraft_alt_controller_jam_board-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file gamecraft_alt_controller_jam_board-0.1.0.tar.gz.

File metadata

  • Download URL: gamecraft_alt_controller_jam_board-0.1.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gamecraft_alt_controller_jam_board-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f95b34f271dce51a096fd0f3403019dd54f00487e0730626014b24c70c361c31
MD5 c32f8a32ce53f83fdb772c37f4c62f98
BLAKE2b-256 a4ebdeaace412d08dd8213e04ae3086b02191d2264962512dc7fbf7a6cf42640

See more details on using hashes here.

File details

Details for the file gamecraft_alt_controller_jam_board-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gamecraft_alt_controller_jam_board-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gamecraft_alt_controller_jam_board-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0a78d204213240ae56c1464ea58c237efd5ee560dee569fe07652d0121eaf6b
MD5 6ea7847c7fc02d4e2c1cda0a6755cd31
BLAKE2b-256 dc9242eda88fe2e254bb9d00497135050983e106886e94b5971eac6ce839db98

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page