ALT.CTRL.GameCraft 2023 Hardware 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
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:
- 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.
- 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.
- gamecraft_alt_controller_jam_board.configurations contains different example keyboard mappings you can use.
- gamecraft_alt_controller_jam_board.hardware contains mappings for pins.
- gamecraft_alt_controller_jam_board.keyboard contains the code which acts as a keyboard, responding to GPIO pins (button clicks) and sending out keycodes.
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.
- To install dependencies:
poetry install - To build:
just build - To flash CircuitPython onto a Pico:
- Hold down the
bootselbutton on the Pico while plugging in the USB cable into your machine - Keep holding it down until a
RPI-RP2disk is mounted - Run
just install-firmware
- Hold down the
- To deploy the built code onto the pico:
just deploy
You can make this process a little more efficient using:
- Run
just watchto see which disk is mounted - After plugging in the pico use
just install-firmware && just deploy && just ejectin another terminal to flash the firmware and install the code in one step.
Setting Up
If you're using mise it should activate automatically.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gamecraft_alt_controller_jam_board-0.1.1.tar.gz.
File metadata
- Download URL: gamecraft_alt_controller_jam_board-0.1.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d4ddd348a71cd60727e24c2582a26118d780c6b2842da5577199ac8b9226c22
|
|
| MD5 |
7ba61ef4b06ffb96dd248de81b2a07ff
|
|
| BLAKE2b-256 |
32c5c626c958cd5e8ee1d2868f6a6ba6965c721be55e46d76009665d0927388a
|
File details
Details for the file gamecraft_alt_controller_jam_board-0.1.1-py3-none-any.whl.
File metadata
- Download URL: gamecraft_alt_controller_jam_board-0.1.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b42d1ebd7ba3e0092447b08695b79503835df702a7c25a9e559ede62612dec89
|
|
| MD5 |
e7943107631da7782174098039932404
|
|
| BLAKE2b-256 |
d278ed1c9cb963bf878e4ca0e82fe39b13f6d58c9616eb1f028ec8db0a700b0d
|