Skip to content

About

A cartridge to test input functionality.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PRG32 Input Tester

PRG32 Input Tester is an original utility cartridge designed to verify hardware input functionality, screen drawing, and audio capabilities on PRG32 devices. It provides immediate visual and auditory feedback for every PRG32 button and for the analog joystick, making it an ideal diagnostic tool for testing newly assembled hardware or custom controllers.

The project follows the PRG32 cartridge convention: the C source exports input_tester_init, input_tester_update, and input_tester_draw, matching the build conventions used by PRG32 cartridges.

Modes

Hold START for one second to switch between the two modes. A short START press is tested like any other button.

Buttons mode

  • D-pad: Left, Right, Up, and Down (<, >, ^, v).
  • Action buttons: A, B, C, and D.
  • Bumpers: L and R.
  • System button: START (also SELECT, and the stick press on an analog joystick).
  • Visual feedback: Buttons illuminate with a yellow highlight and inverted text when pressed.
  • Multi-key registration: Detects and displays a "Multiple keys registered" flag when more than one button is pressed simultaneously. This is useful for diagnosing key ghosting or wiring issues.
  • Audio status indicator: Displays "Audio is being played" while any button is held down.

C, D, L, and R exist only on hardware that wires them (for example the breadboard2 profile); elsewhere they never light up.

Joystick mode

  • Visualizer: the outer circle is the whole stick area and the inner circle is the stick. The inner circle touches the outer one at full tilt, and turns yellow while the stick is pressed.
  • Axis values: X and Y from prg32_input_axis_x() and prg32_input_axis_y(), from -127 (left/up) to 127 (right/down).
  • Raw readings: the 12-bit ADC values (0 to 4095) from prg32_input_axes_raw().
  • Source: ANALOG with an analog stick; D-PAD without one, where the firmware turns the directions into -127, 0, or 127, so the stick jumps between the centre and the edges.
  • Directions: the D-pad bits the firmware derives from the stick, to check the direction threshold.

If the stick does not rest at the centre or does not reach the circle, calibrate it in the PRG32 setup menu (SETUP → JOYSTICK CALIBRATION).

Sounds

Each button plays its own note with prg32_audio_note_on_pan() while it is held, using the default instrument. PRG32 mixes 8 voices, so buttons that are rarely held together share one: LEFT/RIGHT, UP/DOWN, and L/R. Left-side buttons are panned left and right-side buttons right, which also checks stereo output.

Requirements

PRG32 firmware with cartridge ABI 1.7 or later, which provides the analog axis calls. Older firmware rejects the cartridge.

Build

From this folder, with the ESP-IDF environment loaded (source $HOME/esp-idf/export.sh):

PRG32_REPO=/path/to/PRG32 PRG32_ARCHITECTURE=esp32c6 scripts/build.sh
PRG32_REPO=/path/to/PRG32 PRG32_ARCHITECTURE=qemu scripts/build.sh

The cartridges are written to dist/inputtester_<architecture>.prg32 with the Store metadata attached. Upload one to a board over USB with:

python3 -m prg32 esp32c6 upload dist/inputtester_esp32c6.prg32 --slot cart1 --command run

(run from the PRG32 repository, with the cartridge path adjusted).

Capabilities exercised

PRG32 Input Tester deliberately stresses PRG32 subsystems: text rendering, colored rectangle drawing (UI highlights), integer circle drawing (midpoint outline and filled rows), edge-detection logic for inputs, bitwise masking, multi-button state tracking, analog axis reading, and table-driven audio with panning.

License

Code is MIT. See LICENSE.

About

A cartridge to test input functionality.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages