SDK crate

psx-pad

Controller polling, button edges and action mapping

On this page

Use psx-pad to read digital controllers and DualShock analog input over SIO0. It returns active-high button masks, even though the controller wire protocol uses active-low values.

How the crate is organized

The root defines button masks, pad state, polling, analog helpers and action mapping. PadReader is bound to one port and returns the last clean state when a poll comes back garbled, and require_analog_on asks a DualShock for analog mode and locks it. Polling takes the ControllerPort token by &mut. tracker::PadTracker, also reexported at the root, tracks per-button edges and repeat timing.

Integration notes

Poll once for an update and share that result with your game systems. Use held state for continuous motion and an edge for a one-shot action. A group-level pressed_since check and a per-button tracker have different semantics; pick the one that fits when you test several buttons. Analog mode is not guaranteed: inspect the pad state and support a fallback. Memory-card traffic shares SIO0, so coordinate transactions rather than polling from competing owners.

Read the controller how-to and complete hello-input source.

API, dependencies and source structure

SDK revision f2fec1c301f1. Structure, dependencies and features below come from this revision.

The PS1 reference includes all Cargo features. The manifest below shows which features are enabled by default.

Dependencies

  • psx-hw (shared repository crate): all targets
  • psx-io: all targets
  • psx-math: all targets

Cargo features

This crate declares no Cargo features.

Read the complete manifest and feature comments.

Source layout

The list includes internal implementation and test files. Public modules, types, functions and their signatures are indexed in the API reference above.

5 source and manifest files