Joysticks
A joystick controls the mouse pointer through analog inputs. Configuration through keyboard.toml supports nRF52 chips with an SAADC peripheral. Use a debug probe to calibrate the joystick for your hardware.
TOML configuration
Add one entry per joystick to keyboard.toml:
Match the dimensions of bias and transform to the number of configured axes. The example uses two axes; larger positive diagonal divisors reduce pointer speed.
Calibration
- For the two-axis example, start with
bias = [0, 0],transform = [[1, 0], [0, 1]], andresolution = 1. - Enable debug logging and read
JoystickProcessor::generate_report: record = [...]with the joystick released. Set each bias to the negative of that axis's resting value. - Increase the diagonal transform values to reduce pointer speed.
- Increase
resolutionif the pointer jitters at rest.
Sampling
RMK reads the configured axes in one ADC scan. After 1.2 seconds without significant changes between consecutive joystick samples, it uses the idle interval. Battery voltage changes do not trigger fast joystick sampling. When battery measurement shares the ADC with a joystick, battery voltage is reported at most once every 30 seconds.
Rust configuration
Use one NrfAdc for the joystick and battery channels. In your firmware initialization, list events in ADC channel order and match the joystick device ID to its processor. This example assumes p, matrix, and keymap are already initialized.
polling_interval sets the active scan interval. light_sleep sets the initial and idle interval; None uses polling_interval throughout.